Chrome最近更新了一个恼人的弹出窗口,该弹出窗口来自地址栏中的图标,并提示在用户提交表单时在页面上保存密码.此页面上没有其他输入框,没有其他浏览器提示保存此密码,因此我不知道Chrome的原因.它是一个密码,因此它不应该在输入框中以纯文本形式显示,但它不是应该保存的密码 - 它不是登录凭据.实际上非常重要的是计算机的用户不知道这个密码 - 其他人必须为他们输入密码 - 所以如果浏览器保存它就会很糟糕.
如何防止Chrome(和所有浏览器)提示您保存此密码?
<form action="/..." method="post" onsubmit="return pwFormIsSubmittable();">
<p>Password: <input autofocus="" type="password" name="1409_password" style="width:100px" tabindex="1" autocomplete="off"></p>
<div class="tabSubmitButtons">
<input type="button" name="event=default" value="Cancel" onclick="window.location='...'" tabindex="3">");
<input type="submit" value="Submit" onclick="submitForm();" tabindex="2">
<input type="hidden" name="begin" value="Yes">
<!-- couple other hidden inputs -->
</div>
</form>
Run Code Online (Sandbox Code Playgroud)

我目前正在开发具有“更改当前密码”功能的 Angular 应用程序。但是,如果我在关联的输入字段中输入旧密码和新密码,Chrome 会将它们识别为用户名和密码,尽管这些字段都被声明为密码类型。所以在我的理解中,Chrome 不应该有机会从表单中保存用户名,因为没有输入字段type="text"或autocomplete="username"。这是一些代码来指定我的问题:
<form class="changePwForm" [formGroup]="changePwForm">
<mat-form-field appearance="legacy">
<mat-label>Old Password</mat-label>
<input matInput [type]="hideOldPw ? 'password' : text" formControlName="oldPassword" autocomplete="current-password">
<button mat-icon-button matSuffix (click)="hideOldPw = !hideOldPw" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
<mat-icon>{{hideOldPw ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
</mat-form-field>
<br>
<mat-form-field appearance="legacy">
<mat-label>New password</mat-label>
<input matInput [type]="hideNewPw ? 'password' : text" formControlName="newPassword" autocomplete="new-password">
<button mat-icon-button matSuffix (click)="hideNewPw = !hideNewPw" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
<mat-icon>{{hideNewPw ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
</mat-form-field>
<mat-form-field appearance="legacy">
<mat-label>Repeat new password</mat-label>
<input matInput [type]="hideNewPwRepeat ? …Run Code Online (Sandbox Code Playgroud)