2019,Chrome 76,自动完成关闭方法 [英] 2019, Chrome 76, approach to autocomplete off

查看:245
本文介绍了2019,Chrome 76,自动完成关闭方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此的信息很少.您需要花费数小时来仔细研究每个答案,测试,阅读评论,以发现没有解决方案.您在2019年做了什么工作,Chrome 76可以正常工作?

There are are few posts out there about this. You spend hours going through each answer, testing, reading comments, to find that there is no solution. What have you done in 2019, Chrome 76, that works?

推荐答案

更新,2020年1月:似乎从Chrome 79开始,自动填充"(如此处定义)不再将autocomplete="some-unrecognised-value"视为等于autocomplete="on",因此autocomplete="nope"或类似版本现在可以同时禁用自动填充"和自动填充"功能.

Update, January 2020: It appears that as of Chrome 79, Autocomplete (as defined here) no longer treats autocomplete="some-unrecognised-value" as equal to autocomplete="on", so autocomplete="nope" or similar is now effective at disabling both Autocomplete and Autofill.

更新,2020年4月:他们再次对其进行了更改.从Chrome 81开始,autocomplete="some-unrecognised-value"在禁用自动完成机制方面不再有效.但是,自动填充"现在似乎比以前更加保守-它仍未遵循规范(带有name="email"autocomplete="off"的字段仍会收到自动填充"建议),但是它没有提供虚假地址随机形式字段上的片段.因此,我现在的建议是使用autocomplete="off".如果您想在名为email的字段上执行此操作,那么您可能会很不走运:-(

Update, April 2020: They changed it again. As of Chrome 81, autocomplete="some-unrecognised-value" is no longer effective at disabling the Autocomplete mechanism. However, Autofill now seems to be a lot more conservative than it was before - it still doesn't follow the spec (a field with name="email" and autocomplete="off" will still receive Autofill suggestions) but it doesn't offer up spurious address fragments on random form fields. My recommendation right now would therefore be to use autocomplete="off". If you want to do that on a field named email, you're probably out of luck though :-(

TL,DR:autocomplete属性似乎没有任何设置可以可靠地关闭所有自动完成下拉菜单.但是,导致这种情况的情况令人费解,值得记录,以期希望清除大量相互矛盾的建议...

TL,DR: There appears to be no setting for the autocomplete attribute that will reliably turn off all autocomplete dropdowns. However, the circumstances that have led to this are quite convoluted and worth documenting, to hopefully clear up the masses of conflicting advice...

当前(76.0.3809.132)版本的Chrome中存在两种不同的机制,我们将其称为自动填充"和自动填充"(不一定是其官方名称):

There are two distinct mechanisms present in current (76.0.3809.132) versions of Chrome, which we'll refer to as Autofill and Autocomplete (not necessarily their official names):

自动填充"功能尝试使用存储在浏览器设置中的地址信息填写表格.可以通过下拉菜单底部的管理地址..."选项(或类似名称)进行标识. Chrome开发人员的故意决定,此功能不支持autocomplete="off"autocomplete="false".

The Autofill feature attempts to fill in forms using the address information stored in your browser settings. It can be identified by the "Manage addresses..." option (or similar) at the bottom of the dropdown. This feature does not honour autocomplete="off" or autocomplete="false", as a deliberate decision on the part of the Chrome developers.

概述该决定的声明中,zkoch提供了以下解决方法:

In a statement outlining this decision, zkoch offered this workaround:

如果您确实要禁用自动填充功能,我们的建议为 这一点是利用自动完成属性赋予有效值, 对您的字段的语义含义.如果遇到自动完成 我们无法识别的属性,我们不会尝试填充它.

In cases where you really want to disable autofill, our suggestion at this point is to utilize the autocomplete attribute to give valid, semantic meaning to your fields. If we encounter an autocomplete attribute that we don't recognize, we won't try and fill it.

例如,如果您的CRM工具中有一个地址输入字段 您不希望Chrome自动填充的字词,您可以为其赋予语义 相对于您的要求有意义的含义:例如 autocomplete ="new-user-street-address".如果Chrome遇到了这种情况, 不会尝试自动填充该字段.

As an example, if you have an address input field in your CRM tool that you don't want Chrome to Autofill, you can give it semantic meaning that makes sense relative to what you're asking for: e.g. autocomplete="new-user-street-address". If Chrome encounters that, it won't try and autofill the field.

这是尝试的解决方案(例如autocomplete="nope")的基础;自动填充机制将跳过任何无法识别的具有autocomplete属性值的字段.

This is the basis of attempted solutions such as autocomplete="nope"; the Autofill mechanism will skip any fields with autocomplete attribute values it doesn't recognise.

实施此决定的代码,以供记录:

The code that implements this decision, for the record: https://chromium.googlesource.com/chromium/src/+/refs/tags/78.0.3903.1/components/autofill/core/browser/form_structure.cc#1218

自动完成"功能提供了此表单字段中先前提交的值的下拉列表.此下拉菜单没有管理地址..."选项.自动完成功能可以使用autocomplete="off"autocomplete="false"属性;其他任何值(包括诸如autocomplete="nope"之类的无效"值)都将保持启用状态.

The Autocomplete feature provides a dropdown of previously-submitted values from this form field. This dropdown does not have a "Manage addresses..." option. Autocomplete does honour the autocomplete="off" or autocomplete="false" attribute; any other value (including 'invalid' ones such as autocomplete="nope") will leave it enabled.

无法通过autocomplete下拉列表关闭自动完成下拉列表;禁用自动填充"的任何值都将启用自动填充"功能,反之亦然.任何认为自己找到了可行解决方案的人(通过autocomplete或其他诸如CSS hacks的方法)都应检查其是否符合两种机制.

Autocompletion dropdowns cannot be turned off through the autocomplete dropdown; any value that disables Autofill will leave Autocomplete enabled, and vice versa. Anyone who thinks they've found a working solution (either through autocomplete or some other method such as CSS hacks) should check that it works against both mechanisms.

不幸的是,要说服Chrome开发人员这已经被打破,将是艰巨的努力. Autofill的开发人员显然认为,他们在为Web开发人员提供替代方案的同时,做出了打破autocomplete="off"的明智决定.这种替代方法被打破了,原因是比他们意识到的更微妙的原因.从他们的角度来看,由此产生的抗议之声来自不满的人.开发人员懒得跳过一个小小的箍并更新其autocomplete="off"属性.在所有杂音中,消息都无法通过:环已损坏.

Unfortunately it's probably going to be an uphill struggle to convince Chrome's developers that this is broken. The developers of Autofill apparently believe that they made a calculated decision to break autocomplete="off" while offering web developers an alternative; that alternative is broken, for more subtle reasons than they realise. From their perspective, the resulting howls of protest are coming from disgruntled developers too lazy to jump through one little hoop and update their autocomplete="off" attributes. In all the noise, the message isn't getting through: the hoop is broken.

这篇关于2019,Chrome 76,自动完成关闭方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆