Chrome, Safari and Opera do not remember password

2019-07-03 17:55发布

问题:

I first had the problem with an AJAX login, and after looking for a solution for hours I thought I would try something as simple as this:

<html>
    <head></head>
    <body>
        <form id="login_form" action="login.html" method="post">
            <input type="text" id="login_username" value="" />
            <input type="password" id="login_password" value="" />
            <input type="submit" id="login_submit" value="Login" />
        </form>
    </body>
</html>

It goes to login.html but does not offer to save the password! I thought it might be a localhost issue so i deployed on the server and still, Chrome does not offer to store the password. FF and IE work as expected but Chrome, Safari and Opera do not.

"Offer to save passwords I enter on the web" is checked.

"Never saved" is empty.

回答1:

Wow. This should be noted somewhere. I suspect it probably is but I just could not find it...

The solution is the name tag in both username and password fields. If these are missing then Chrome will not offer to save the password. Once I added the name tags Chrome and Opera started to offer to save the password.

Safari is still not doing it.

<html>
  <head></head>
  <body>
    <form id="login_form" action="login.html" method="post">
      <input type="text" id="login_username" name="login_username" value="" />
      <input type="password" id="login_password" name="password_username" value="" />
      <input type="submit" id="login_submit" value="Login" />
    </form>
  </body>
</html>