我创建了一个使用标签框下拉的web应用程序。除了Chrome浏览器(Version 21.0.1180.89),这在所有浏览器中都很有效。

尽管输入字段和表单字段都有autocomplete="off"属性,Chrome坚持显示该字段以前条目的下拉历史,这是删除标签框列表。


当前回答

看起来这是固定的!参见https://codereview.chromium.org/1473733008

其他回答

对于这个问题,我使用了这个css解决方案。这对我很有用。

input{
  text-security:disc !important;
  -webkit-text-security:disc !important;
  -moz-text-security:disc !important;
}

更新

现在Chrome似乎忽略了style="display: none;"或style="visibility: hidden; "属性。

你可以把它改成这样:

<input style="opacity: 0;position: absolute;">
<input type="password" style="opacity: 0;position: absolute;">

根据我的经验,Chrome只自动完成第一个<input type="password">和前一个<input>。所以我添加了:

<input style="display:none">
<input type="password" style="display:none">

到<form>的顶部,该情况得到解决。

似乎Chrome现在忽略autocomplete="off",除非它是在<form autocomplete="off">标签。

Chrome版本34现在忽略autocomplete=off, 看到这个。

很多关于这是好事还是坏事的讨论?你的观点是什么?

在chrome v. 34之后,在<form>标记处设置autocomplete="off"不起作用

我做这些改变是为了避免这种恼人的行为:

删除密码输入的名称和id 在输入中放入一个类(例如:passwordInput)

(到目前为止,Chrome不会把保存的密码输入,但形式现在是破碎的)

最后,为了让表单工作,当用户点击提交按钮时,或者当你想触发表单提交时,运行以下代码:

var sI = $(".passwordInput")[0];
$(sI).attr("id", "password");
$(sI).attr("name", "password");

在我的情况下,我曾经在密码输入中有id="password" name="password",所以我在触发提交之前把它们放回去。