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

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


当前回答

自动完成=“关闭”不再工作。

尝试使用一个随机字符串来代替"Off",例如Autocomplete="NoAutocomplete"

我希望这能有所帮助。

其他回答

Chrome一直在改变它在每个版本上处理自动完成的方式,我提出的方式是,使字段只读和onclick/focus使它非只读。试试这个jQuery片段。

jQuery(document).ready(function($){
//======fix for autocomplete
$('input, :input').attr('readonly',true);//readonly all inputs on page load, prevent autofilling on pageload

 $('input, :input').on( 'click focus', function(){ //on input click
 $('input, :input').attr('readonly',true);//make other fields readonly
 $( this ).attr('readonly',false);//but make this field Not readonly
 });
//======./fix for autocomplete
});

你可以使用autocomplete="new-password"

<input type="email" name="email">
<input type="password" name="password" autocomplete="new-password">

适用于:

Chrome: 53,54,55 火狐:48、49、50

我发布这个答案是为了给这个问题带来一个更新的解决方案。 我目前使用的是Chrome 49,没有给出的答案。 我也在寻找一个解决方案与其他浏览器和以前的版本。

把这些代码放在表单的开头

<div style="display: none;">
    <input type="text" autocomplete="new-password">
    <input type="password" autocomplete="new-password">
</div>

然后,对于您的真实密码字段,使用

<input type="password" name="password" autocomplete="new-password">

如果这不再工作,或如果您遇到其他浏览器或版本的问题,请注释此答案。

批准:

Chrome浏览器:49 Firefox: 44,45 边缘:25 Internet Explorer: 11

对任何想要解决这个问题的人来说,我终于明白了。

Chrome只服从的自动完成="off"如果页面是HTML5页面(我使用XHTML)。

我把我的页面转换成HTML5,问题就消失了(捂脸)。

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