构建一个允许浏览器使用用户名/电子邮件预先填充的表单。密码

时间:2010-08-01 00:29:40

标签: javascript html firefox forms google-chrome

用户抱怨我的网站,并说他们登录表单“不允许Firefox和Chrome浏览器”记住密码“。您应该允许人们在浏览器中记住密码 - 它会派上用场未来访问的未来。“

为什么会出现这种情况?

1 个答案:

答案 0 :(得分:1)

确实是的。有一个非标准但可识别的autocomplete attribute可以应用于表单元素。

在HTML中检查以下内容:

<input type="password" name="the-password" id="the-password" autocomplete="off"/>

它也可以通过Javascript设置:

var thePassword = document.getElementById('the-password');
thePassword.setAttribute("autocomplete", "off");