Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript prompt for password (i.e. *******)

I'm writing a bookmarklet and I need to be able to prompt the user for a "password". However, I don't want it to be in clear text on screen, so I cannot use prompt.

Is there a masked alternative to prompt()?

Any other suggestion?

like image 279
Assaf Lavie Avatar asked Sep 16 '26 20:09

Assaf Lavie


2 Answers

You can create a floating div on the current page, with a form containing a password field.

like image 98
Ryan Emerle Avatar answered Sep 18 '26 09:09

Ryan Emerle


alternative: let the bookmarlet point to a particular web page. Get the password from the user on that page, and continue.

This solution does not use javascript at all, as you may have noticed. If you really insist on using javascript, you will have to create a new window using javascript (window.open), add form and input elements to it, and set the form's submit value to your web app backend.

you can of course, display a dialog box on the current page, but that will be pretty irritating to the user. Be warned.

jrh

like image 24
jrharshath Avatar answered Sep 18 '26 09:09

jrharshath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!