简体   繁体   中英

Remember input password dialog box, without reloading the page

I am searching a way to make the browser ask the user if he wants to remenber his password, when a form is submited without changing the current page (using the submit event for example).

I made a jsfiddle to show this: http://jsfiddle.net/HeFFh/2 .

<form action="javascript:">
    <input type="text" value="user" />
    <input type="password" value="pass" />
    <input type="submit" />
</form>

When you press the submit button, the browser should ask you if the password have to be remembered.

It only works with Firefox. Am I doing something wrong ?

It is based on browser settings and not on the code.

For chrome: goto -> settings -> show advanced settings -> Passwords and Forum -> Select "Offer to save passwords I enter on the web"

For more help visit this link

I believe you have to have the action attribute set to something other than "javascript:" and the inputs should have a name attribute.

Try this:

<form action="/" >
    <input type="text" value="user" name="username" />
    <input type="password" value="pass" name="password" />
    <input type="submit" />
</form>

This will not override the browser setting, but will allow the feature to be used if it's not turned off by the user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM