我需要阻止浏览器存储用户名和密码值,因为我正在开发一个包含更安全数据的网络应用程序。我的客户要求我这样做。
我在 HTML 表单和密码字段中尝试了 autocomplete="off"
属性。但它不适用于最新的浏览器,如 Chrome 55、Firefox 38+、Internet Explorer 11 等。
最好的解决方案是什么?
最佳答案
谢谢你给我回复。我点击了以下链接
Disable browser 'Save Password' functionality
我通过添加 readonly
& onfocus="this.removeAttribute('readonly');"
属性解决了这个问题 autocomplete="off"
到输入,如下所示。
<input type="text" name="UserName" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
<input type="password" name="Password" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
这对我来说很好。
关于html - 如何防止浏览器存储密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41217019/