如何防止浏览器存储密码 [英] How to prevent a browser from storing passwords
问题描述
我需要停止浏览器存储用户名&密码值,因为我正在使用包含更多安全数据的网络应用程序。我的客户要求我这样做。
I need to stop browsers from storing the username & password values, because I'm working on a web application which contains more secure data. My client asked me to do this.
我尝试了HTML表单中的 autocomplete = off
属性,密码字段。但这不适用于最新的浏览器,例如Chrome 55,Firefox 38 +,Internet Explorer 11等。
I tried the autocomplete="off"
attribute in the HTML form and password fields. But it is not working in the latest browsers like Chrome 55, Firefox 38+, Internet Explorer 11, etc.
最好的解决方案是什么?
What is the best solution for this?
推荐答案
感谢您给我回复。我按照下面的链接
Thank you for giving a reply to me. I followed the below link
我通过添加 readonly
和; onfocus = this.removeAttribute('readonly');
除了输入的 autocomplete = off
属性外,如下所示。
I resolved the issue by just adding readonly
& onfocus="this.removeAttribute('readonly');"
attributes besides autocomplete="off"
to the inputs as shown below.
<input type="text" name="UserName" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
<input type="password" name="Password" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
这对我来说很好。
这篇关于如何防止浏览器存储密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!