![](/img/trans.png)
[英]How do you disable browser autocomplete on web form field / input tags?
[英]How to disable browser autocomplete on angular form field?
我有一個登錄頁面,我想停止自動完成並自動填寫我的表單頁面。
通過使用 autocomplete="off" 自動填充停止。 但是當我單擊輸入字段(密碼或用戶名字段)時,自動完成仍然加載。 如何停止這個自動完成?
我嘗試了以下方法, autocomplete="off", autocomplete="false", autocomplete="new-password" 但它還是來了。
我的示例代碼:
<form #f="ngForm" autocomplete="off">
<mat-form-field floatLabel="auto">
<mat-label>User name</mat-label>
<mat-icon matPrefix>person</mat-icon>
<input matInput
tabindex="1"
#username="ngModel"
[(ngModel)]="userName"
required
name="username"
maxlength="100"
autocomplete="off"
role="presentation">
</mat-form-field>
<mat-form-field floatLabel="auto">
<mat-label>Password</mat-label>
<mat-icon matPrefix>lock</mat-icon>
<input matInput
tabindex="2"
[(ngModel)]="password"
required
name="password"
#pass="ngModel"
type="password"
maxlength="100"
autocomplete="new-password"
role="presentation">
</mat-form-field>
</form>
谷歌瀏覽器版本:76.0.3809.100 版(官方版本)(64 位)
在自動完成和隨機名稱上添加“anystring”以進行標記。
autocomplete="anyrandomstring" name="test"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.