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

前端 未结 4 964
再見小時候
再見小時候 2021-01-14 09:54

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.

4条回答
  •  礼貌的吻别
    2021-01-14 10:23

    The easy, fast answer: No, there are no cross browser method like window.prompt() that masks the user input. There are however some proprietary stuff you could look into. In MSIE you got window.createPopup(), window.showModalDialog() and window.showModelessDialog(). However I don´t reccomend using this approach =P

    What would happen if you used http authentication for your destination? Would the UA prompt the user with a un/pw?

提交回复
热议问题