简体   繁体   English

在 Chrome 中禁用“使用密码”自动完成功能

[英]Disable 'Use Password for' autocomplete in Chrome

I want to disable password autocomplete dropdown(see screenshot below) that opens when I click password field.我想禁用当我点击密码字段时打开的密码自动完成下拉菜单(见下面的截图)。 截屏

This has been frequently asked question.这是经常被问到的问题。 But no solution is working in Chrome Version 61.0.3163.100 .但是在Chrome 版本 61.0.3163.100中没有解决方案。

Solutions tried:尝试的解决方案:

autocomplete="new-password" solution was working until few versions ago. autocomplete="new-password"解决方案在几个版本之前一直有效。 It seems chrome has intentionally removed this in latest versions.似乎 chrome 在最新版本中有意删除了这个。

Is there any other way to achieve this?有没有其他方法可以实现这一目标?

First, you should remember that Chrome password autofill is a feature , not an annoying thing that Chrome put in .首先,您应该记住Chrome 密码自动填充是一项功能,而不是 Chrome 放入的烦人的东西 Also, most users actually like this feature.此外,大多数用户实际上都喜欢此功能。 Instead of having to recall their really long password, and then hopefully put it in correctly, and hope it doesn't say "incorrect password".不必回忆他们真正的长密码,然后希望正确输入,并希望它不会说“密码不正确”。 The idea of Chrome password saving is so it keeps your passwords safe (ironically). Chrome 密码保存的想法是确保您的密码安全(具有讽刺意味)。 But if a hacker manages to get into your browser, then using the password autofill, they can get into all of your passwords.但是,如果黑客设法进入您的浏览器,然后使用密码自动填充,他们可以进入您的所有密码。 And if you reset your password, the Chrome password autofill can be very annoying.如果您重置密码,Chrome 密码自动填充可能会非常烦人。 And because of the password autofill, No solution using <input type="password"> will work , exception for autocomplete="new-password" .并且由于密码自动填充,没有使用<input type="password">的解决方案将起作用autocomplete="new-password"例外。

But don't worry, as there are ways to work around this.但不要担心,因为有一些方法可以解决这个问题。

Use text input and CSS使用文本输入和 CSS

The best way to disable autocomplete is to just use the standard <input type="text"> .禁用自动完成的最佳方法是仅使用标准<input type="text"> And to hide the password, just add a line of CSS.而要隐藏密码,只需添加一行 CSS。 Here is a working example.这是一个工作示例。

 input { -webkit-text-security: disc }
 <input autocomplete="off">

Note that the -webkit is required.请注意, -webkit是必需的。 Read the docs here此处阅读文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM