阻止浏览器自动填写表单用户名和密码字段
问题描述:
在Chrome浏览器中,我已经保存了用户名和密码.
In the Chrome browser, I have saved the username and the password.
现在,如果我导航到其他形式,并且其中包含其他内容的用户名和密码,则我保存的内容将在此处自动填充.
Now, if I navigate to some other form and it contains the username and password for some other stuff, the one I saved is auto-populated here.
我该如何阻止呢?
答
当 autocomplete = off
不会阻止填写凭据时,请使用以下命令-
When autocomplete=off
would not prevent to fill in credentials, use following -
修复浏览器自动填充:只读并设置可写焦点(单击和标签).
fix browser autofill in: readonly and set writeble on focus (click and tab).
<input type="password" readonly onfocus="this.removeAttribute('readonly');" onblur="this.setAttribute('readonly','');"/>