禁止浏览器自动填充账号密码

登录页面常用,登录后浏览器自动填充账号密码,非常不安全,一般为了方便都设置记住密码功能。

解决方法:

方法一

  • 设置autocomplete为off,适用于普通文本框
<input type="text" autoComplete="off"/>
  • 设置autocomplete为new-password,适用于密码输入框
<input type="password" autoComplete="new-password"/>
  • elementui组件同样适用autoComplete属性。

在这里插入图片描述

方法二:

  • 在输入框前边再加一个隐藏的输入框就可以
<!-- 账号 -->
<input type="text" style="display:none"></input>
<input type="text"></input>
<!--密码-->
<input type="password" style="display:none"></input>
<input type="password"></input>

猜你喜欢

转载自blog.csdn.net/ka_xingl/article/details/116747559
今日推荐