我创建了一个使用标签框下拉的web应用程序。除了Chrome浏览器(Version 21.0.1180.89),这在所有浏览器中都很有效。
尽管输入字段和表单字段都有autocomplete="off"属性,Chrome坚持显示该字段以前条目的下拉历史,这是删除标签框列表。
我创建了一个使用标签框下拉的web应用程序。除了Chrome浏览器(Version 21.0.1180.89),这在所有浏览器中都很有效。
尽管输入字段和表单字段都有autocomplete="off"属性,Chrome坚持显示该字段以前条目的下拉历史,这是删除标签框列表。
当前回答
看起来这是固定的!参见https://codereview.chromium.org/1473733008
其他回答
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
});
看起来这是固定的!参见https://codereview.chromium.org/1473733008
更新:08/2022
我设法让自动补全通过包含得到尊重
autocomplete="new-password"
在每个单独的输入元素上。
E.g.
<input id="email" type="email" autocomplete="new-password"/>
对我来说,在表单和输入中设置autocomplete=“off”是有效的。但可以是片状的。有时它会建议密码或一些保存的登录名+密码选项。但不要提前预约。
Chrome版本:81.0.4044.138
CodePen
<表单角色=“表单” 方法=“发布” 操作=“#” 自动完成=“关闭”> <标签=“登录”>登录</label><br/> <输入类型=“文本” 名称=“登录” id=“登录” 自动完成=“关闭” /> <br/><br/> <标签=“密码”>密码</label><br/> <输入类型=“密码” 名称=“密码” 自动完成=“关闭” /> <br/><br/> <输入类型=“提交” 名称=“提交” 值=“提交” /> </form>
其他选项:
删除'form'标签…或者在提交之前将其从'div'更改为'form'。 用javascript和一些contentteditable ="true"字段可以让你的方式…
通常每隔几个月我就得另找工作。
我找到了一个适合我的解决办法。它没有禁用自动完成,但允许自定义它。在Chrome 96, Opera 82测试
/* Change Autocomplete styles in Chrome*/
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
border: none;
border-bottom: 1px solid;
-webkit-text-fill-color: #000;
-webkit-box-shadow: 0 0 0 1000px transparent inset;
}