Html autocomplete="off" 是否与所有现代浏览器兼容?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3868299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:45:51  来源:igfitidea点击:

Is autocomplete="off" compatible with all modern browsers?

htmlforms

提问by EmmyS

I've just been given a requirement to prevent browsers from saving data entered into specific form fields. It's been years since I've done web dev, and this is a relatively new capability. I was able to find the form field property autocomplete="off", but I can't seem to find any documentation indicating which browsers support it. Can anyone point me in the right direction of a chart of form attributes and browser compatibility?

我刚刚被要求防止浏览器保存输入到特定表单字段中的数据。我已经好几年没有做网络开发了,这是一个相对较新的能力。我能够找到表单字段属性 autocomplete="off",但似乎找不到任何说明哪些浏览器支持它的文档。任何人都可以指出表单属性和浏览器兼容性图表的正确方向吗?

回答by David says reinstate Monica

Be aware that all major browsers are moving towards ignoring the attribute for password fields.

请注意,所有主要浏览器都倾向于忽略密码字段的属性

I can only offer anecdotal evidence, but I've yet to come across a browser that fails to respect autocomplete="off", this experience covers:

我只能提供轶事证据,但我还没有遇到过不尊重 的浏览器autocomplete="off",这种体验包括:

  • Firefox 1.5+ (Windows and Ubuntu)
  • Opera 6+ (Windows and Ubuntu)
  • Chrome v2+ (Windows and Ubuntu)
  • Epiphany 0.8 (ish) (Ubuntu)
  • Midori (I can't remember which version)
  • Safari v1+ (Windows)
  • IE 4 - 8, Windows.
  • Firefox 1.5+(Windows 和 Ubuntu)
  • Opera 6+(Windows 和 Ubuntu)
  • Chrome v2+(Windows 和 Ubuntu)
  • 顿悟 0.8 (ish) (Ubuntu)
  • Midori(不记得是哪个版本了)
  • Safari v1+ (Windows)
  • IE 4 - 8,Windows。

I'm aware that Greasemonkey scripts, and presumably other user-scripts, can disable the autocompletesetting.

我知道 Greasemonkey 脚本以及可能的其他用户脚本可以禁用该autocomplete设置。

There's a couple of articles I found that might be useful to you:

我发现有几篇文章可能对您有用:

  1. How to turn off form auto-completion
  2. Using auto-complete in html forms
  1. 如何关闭表单自动完成
  2. 在 html 表单中使用自动完成

回答by Manishearth

Password managers now ignore the autocompleteattribute for passwordfields in the major browsers as of:

密码管理器现在忽略主要浏览器中字段的autocomplete属性password

It should still work fine for disabling autocompleteon form fields, but no longer affects the password manager.

禁用autocomplete表单字段应该仍然可以正常工作,但不再影响密码管理器。

回答by ChrisAdmin

As of Chrome v34, autocomplete="off"is now ignored by default.

从 Chrome v34 开始,autocomplete="off"现在默认忽略。

This somewhat debatable feature can be disabled in the flags configuration by visiting chrome://flags

可以通过访问在标志配置中禁用这个有点有争议的功能 chrome://flags

http://news.softpedia.com/news/Chrome-34-Seeks-to-Save-All-Your-Passwords-436693.shtml

http://news.softpedia.com/news/Chrome-34-Seeks-to-Save-All-Your-Passwords-436693.shtml

回答by ITroubs

If you're able to use JavaScript and jQuery, you can place this on load of the html:

如果你能够使用 JavaScript 和 jQuery,你可以把它放在 html 的加载上:

$('#theform input').val('');

回答by Shockwave29

Except for Maxthon BrowserI think, they are famous in china and making a name now worldwide. They don't treat Autotocomplete=off power very well. It won't work with them.

我想除了傲游浏览器,它们在china都很有名,现在在世界范围内都有名。他们没有很好地对待 Autotocomplete=off 电源。这对他们不起作用。

回答by SarwarCSE

Some solution is not working in modern browsers.

某些解决方案在现代浏览器中不起作用。

Another solution link is given here. which works in all modern browsers.

此处给出了另一个解决方案链接。它适用于所有现代浏览器。

Input type=password, don't let browser remember the password

输入类型=密码,不要让浏览器记住密码

You can use autocomplete="off"in this given soluton

您可以在此给定解决方案中使用autocomplete="off"

回答by NixRam

Matter of fact, both username and password fields doesn't react to AutoComplete=off in all the latest browsers.

事实上,在所有最新浏览器中,用户名和密码字段都不会对 AutoComplete=off 做出反应。