谷歌浏览器禁止表单自动填充

在项目开发期间发现谷歌浏览器有记住密码的功能,该功能有个问题就是一遇到input type=password就开始自动填充,同一个帐户还好,就是bug了。找了一堆解决方案终于找到了办法,下面分享一下解决方案。
一、不生效方案:chrome

<input type="text"  style="display: none;" disabled autocomplete = "off"/>
<input type="password"  style="display: none;" disabled autocomplete = "off"/>
<input autocomplete="off" type="text" /> 
<input autocomplete="off" type="text" onfocus="this.type='password'" />

附:在表单的状况下再加一个input隐藏的方式去填充,对我来讲无效。谷歌版本 73.0.3683.86(正式版本) (64 位)浏览器

解决方案:
一、能够在不须要默认填写的input框中设置 autocomplete="new-password" (亲测有效)this

<input type="password" v-model="form.password" class="form_input" autocomplete="new-password" placeholder="请输入/>

二、修改readonly属性.net

<input type="password" readonly onfocus="this.removeAttribute('readonly');"/>

这种方式的话感受不如方案一来的好,不过也是能够的。
还有其余的解决方案不过我没有试验,这两种是行之有效的办法。
参考资料:
https://blog.csdn.net/xw50550...
https://stackoverflow.com/que...code

相关文章
相关标签/搜索