Chrome 中的密码记忆和自动完成启发式

Gil*_*il' 7 password-management google-chrome forms autocomplete

Chrome 决定保存登录表单数据并在下次访问时自动完成它们的启发式是什么?

如果 Chrome 没有在特定表单上保存凭据,可能是什么原因?我知道:

实验上,这还不够:我有一个登录页面(私人的,抱歉,但代码的要点如下)满足两个条件并且凭据不会自动完成。


这是我的具体问题。我已经用另一种方式解决了这个问题(通过安装自动填充并让它在表单上输入我的凭据),但我仍然想知道为什么 Chrome 不提供保存凭据。

一个网站(不是我写的,也不能公开访问)需要用户名和密码。它使用了一个相当标准的(在我不知情的眼中)形式,它看起来像这样(我省略了很多嵌套<div>和诸如此类的东西,这里显示的属性和函数fooXXX是我重命名的)。

<form name="aspnetForm" method="post" action="default.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">
  <table>
    <tr>
      <td>Username:</td>
      <td><input name="foo$name" type="text" id="foo_name" tabindex="1" autocomplete="off" onkeyup="fooFunction()" style="width:175px;" /></td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><input name="foo@pass" type="password" id="foo_pass" tabindex="2" value="" autocomplete="off" style="width:175px;" /></td>
    </tr>
  </table>
</form>
Run Code Online (Sandbox Code Playgroud)

我希望我的浏览器记住我在这个网站上的凭据。该功能已在浏览器中启用,但该站点有一些特殊之处,导致 Firefox 和 Chrome 都不提供记住名称和密码的功能。

我写了一个用户脚本(Firefox 中的 Greasemonkey 脚本,Chrome 中的解压扩展)更改autocomplete="off"autocomplete="on"

document.querySelector("#foo_user").setAttribute("autocomplete", "on");
document.querySelector("#foo_pass").setAttribute("autocomplete", "on");
Run Code Online (Sandbox Code Playgroud)

在 Firefox 中,这具有预期的效果:Firefox 提供记住密码的功能,下次我访问登录页面时,我的凭据会自动填充。

在 Chrome (27.0.1453.93, Linux) 中没有这样的运气。系统不会提示我记住密码,也不会获取用户名字段的历史记录。我已经确认脚本是通过检查input元素来执行的,它们确实显示autocomplete="on".

我尝试将这些行添加到我的用户脚本中,但它们并没有改善情况。

document.querySelector("#foo_user").removeAttribute("onkeyup");
document.querySelector("#foo_pass").removeAttribute("value");
Run Code Online (Sandbox Code Playgroud)

Chrome 的启发式方法与 Firefox 有何不同,我如何让它记住我的凭据?

std*_*err 1

使用autocomplete=on扩展。

将网页中的“autocomplete=off”更改为“autocomplete=on”,以便记住您的密码。