问题描述
我尝试过使用自动完成假和自动完成关闭.缓存已从该字段中删除,但我仍然看到 chrome 自动填充数据.有没有办法以角度形式禁用 chrome 自动填充选项?任何建议,将不胜感激.谢谢
I have tried using autocomplete false and also auto complete off. The cache is removed from the field, but iam still seeing chrome autofill data. Is there a way to disable chrome autofill option in angular forms? Any suggestions would be appreciated. Thanks
推荐答案
Chrome 有效地尊重了 autocomplete="off",但您遇到的是 Chrome 自动填充功能接管,忽略了 autocomplete="off":https://developers.google.com/web/更新/2015/06/checkout-faster-with-autofill.
The autocomplete="off" is effectively respected by Chrome, but what you're experiencing is the Chrome autofill functionality that takes over, ignoring autocomplete="off": https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill.
过去,许多开发人员会在他们的表单字段中添加 autocomplete="off" 以防止浏览器执行任何类型的自动完成功能.虽然 Chrome 仍会在自动完成数据中尊重此标记,但在自动填充数据中不会尊重它.
一种解决方法是在自动完成中放置一个未知值,例如.在测试这个时,它大部分时间对我有用,但后来由于某种原因不再工作了.
One workaround is to put an unknown value in the autocomplete, e.g. <input type="text" name="somethingAutofillDoesntKnow" autocomplete="doNotAutoComplete" />
. When testing this it worked for me most of the time, but for some reason didn't work anymore afterwards.
我的建议是不要反对它并通过正确使用自动完成属性来利用它的潜力,如下所述:https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill
My advise is not to fight against it and use it's potential by properly using the autocomplete attribute as explained here: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill
这篇关于有没有办法禁用角度表单字段的 chrome 自动填充选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!