百度到了很多,实验了很多,现在我把实验结果列出来。
实验时间:2018-07-16 下午 风和日丽,就是有点热 ^ ^
实验环境:chrome、firefox、360安全浏览器、IE(下面是具体的版本截图)
解决方法一
解决chrome浏览器自动填充密码
<input type="password" readonly onfocus="this.removeAttribute('readonly')" value="" autocomplete="off">
标题很对,不仅解决了chrome浏览器自动填充密码,还把实验环境中的所有浏览器都解决了。
但是,但是,在IE11中需要点击密码输入框,才能够输入。
解决方法二
看到别人博客下有几个评论说直接用 autocomplete="new-password"
然后,我多嘴回复了一句:“在360安全浏览器下不灵!”
截图为证
解决方法三
在页面的 第一个password元素 (有些页面会有多个password,如注册页面)之前加入一行代码:
<input type="password" style="display: none;">
同样的,其他都好用,就在360浏览器中不灵!
解决方法四
<input type="text" class="demo" id="demo" placeholder="请输入密码" autocomplete="off" onfocus="this.type='password'">
在chrome浏览器中好用;在firefox会有下拉用户名、密码;在360浏览器中不灵
(这是firefox下的截图)