开发者

Copy from a password field in form

I was d开发者_如何学JAVAesigning a form which asks the user to type in a password and then to verify again in the next field. I noticed however, that if I copy and paste from the first password field to the other, the values are not same.

It seems my Firefox running on Mac OS X, copies the asterisk graphic instead, which has the value '\x95'

Is it possible to copy the underlying text from the password field?

Thanks


No. Copy/Paste is disabled for security reasons. If you want to allow people to copy/paste the password, why require verification in the first place?

Edit:

If you really want to copy the password to the user's clipboard, it's possible using JavaScript and Flash, but I strongly recommend against it since it's a big security problem.

You can use javascript to get the password:

var input = document.getElementById('myInputId');
var password = input.value;

And this library will let you copy data to the clipboard.

Then again, if you consider this acceptable then the password must not really be a secret. In that case, why not use a normal text field?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜