简体   繁体   English

如何禁用 Chrome 上输入的地址自动完成功能?

[英]How to disable the address autocomplete for an input on Chrome?

I started with this solution:我从这个解决方案开始:

<input autocomplete="off"/>

which worked for current safari and firefox, and some chromes.适用于当前的 safari 和 firefox,以及一些 chromes。 But then I am now trying to do this:但后来我现在试图这样做:

<input autocomplete="hello-<timestamp>-<randomnumber>"/>

That works for firefox, chrome, and safari on Mac, but not for windows.这适用于 Mac 上的 firefox、chrome 和 safari,但不适用于 Windows。 I only want to disable some of the inputs in a form, not all.我只想禁用表单中的某些输入,而不是全部。

How do I get this to work on Chrome for Windows?如何让它在 Windows 版 Chrome 上运行?

This is for a non-password field, like a phone number or username.这是用于非密码字段,如电话号码或用户名。 I understand that you can't really disable autocomplete for passwords these days.我知道您现在无法真正禁用密码自动完成功能。

Add to all fields autocomplete="off" .添加到所有字段autocomplete="off" Then check which fileds still perform an autocomplete (for the address), and set the ones to autocomplete="address-level4" (thank you @michael crenshaw).然后检查哪些文件仍然执行自动完成(对于地址),并将这些文件设置为autocomplete="address-level4" (谢谢@michael crenshaw)。

Also I found out, that the autocpmlete happens depending on the naming of the id of the input.我还发现,autocpmlete 的发生取决于输入 id 的命名。 So if you want to disable it just do not set the id (which probably isnt what you want depending on how you process the input, thus this is not really a good clean solution).因此,如果您想禁用它,请不要设置 id(根据您处理输入的方式,这可能不是您想要的,因此这不是一个很好的干净解决方案)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM