Last active
September 18, 2018 10:25
-
-
Save wxingheng/f235201fe7ccdc707c18cfb72661a271 to your computer and use it in GitHub Desktop.
html页面禁止自动填充浏览器记住的密码;阻止浏览器弹出表单文本框、密码框提示;html运用(三) html如何禁止(表单)用户名、密码自动填充 input password form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html登录表单经常被自动填充,有的甚至用户从来没有登录过的网站也会有自动填充,甚是让人讨厌。 | |
Mozilla developer documentation 建议使用表单设置属性 **autocomplete=”off” 只能和 type="text" 结合使用** 来阻止浏览器从cache获取数据填充登录表单。 | |
**正确方式1** | |
表单设置属性 **autocomplete=”new-password” 必须结合 type="password" 使用** | |
```language | |
<input type="password" name="password" autocomplete="new-password" /> | |
``` | |
**正确方式2 <个人实测方本方案更加好用>** | |
```language | |
<input type="text" name="username"/> | |
<input class="input-pwd" type="text" name="password" autocomplete="new-password" /> | |
<style> | |
.input-pwd{ | |
-webkit-text-security: disc; | |
} | |
</style> | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment