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

前端之家收集整理的这篇文章主要介绍了html – 如何在Firefox中的登录/密码字段中使autocomplete = off工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

但是由于一些疯狂的原因,即使我完全清除浏览器历史记录,浏览器也会继续存储和显示值.所以,我想知道为什么autocomplete =“off”不起作用.可能还有另一种更合适的方法. PS.我不确定它是否重要,但我使用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,the browser will autofill those fields the next time the user visits this page.

虽然这背后的推理是值得商榷的,但这是预期的行为.

原文链接:https://www.f2er.com/html/426901.html

猜你在找的HTML相关文章