html - 如何使 autocomplete=off 在 Firefox 的登录/密码字段中工作

标签 html firefox autocomplete passwords

我想阻止浏览器存储和显示输入值。我就是这样做的:

<form autocomplete="off">
<input type="text" autocomplete="off" name="login" />
<input type="password" autocomplete="off" name="pswd" />
...
</form>

但出于某些疯狂的原因,即使我完全清除了浏览器历史记录,浏览器仍会继续存储和显示值。所以,我想知道为什么 autocomplete="off" 不起作用。可能还有另一种更合适的方法来做到这一点。附言。我不确定它是否重要,但我正在使用 jquery 构建我的表单。

编辑

顺便说一句,与官方 W3C 相反 documentation , 在 HTML5 中 autocomplete="off" 不受尊重(至少在 FF 中)。

最佳答案

来自 https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields :

[...] many modern browsers do not support autocomplete="off" for login fields.

  • if a site sets autocomplete="off" for a form, and the form includes username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.
  • if a site sets autocomplete="off" for username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.

虽然这背后的原因值得商榷,但这是有意为之的行为。

关于html - 如何使 autocomplete=off 在 Firefox 的登录/密码字段中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32964583/

相关文章:

html - 如何使我的长高度图像滚动条可见并且图像本身可见

php - 如何在可选列表中查看实时搜索结果?

javascript - 在 jQuery 中,在页面加载时滑动没有动画的元素?

javascript - PHP 正则表达式 (.*?) 和回调\\1 等效的 JavaScript

javascript - 使用 JavaScript 切换/警告浏览器选项卡

javascript - chrome 下可以按数字键,firefox 下不行?

javascript - Protractor 测试用例无法在 Firefox 上运行

bash - 如何在其他目录中扩展 bash 补全?

javascript - 使用 jQuery-UI 自动完成选择选项时设置多个输入的值

javascript - 输入自动完成的非 JavaScript 版本需要建议