【发布时间】:2021-07-13 07:03:32
【问题描述】:
我通过密码管理器在 chrome 浏览器中保存了密码,并且我有以下 输入字段
<input type="text" placeholder="" formControlName="username" #log_name autocomplete="off">
<input type="password" placeholder="" formControlName="password" #pass autocomplete="off">
每次页面刷新浏览器都会自动填充字段
我所做的是在输入中输入 readonly 和 onfocus 以禁用自动填充
<input type="text" placeholder="" formControlName="username" #log_name autocomplete="off"
readonly onfocus="if (this.hasAttribute('readonly')) {this.removeAttribute('readonly');}>
<input type="password" placeholder="" formControlName="password" #pass autocomplete="off"
readonly onfocus="if (this.hasAttribute('readonly')) {this.removeAttribute('readonly');}>
现在自动填充会停止每次刷新,这很好。
问题
【问题讨论】:
标签: html angular password-manager