javascript - 以编程方式禁用 Chrome 自动填充
问题描述
解决方案
autocomplete="off"
doesn't work anymore. The only thing which works as of 2019 is autocomplete="new-password"
Check this link on Chromium Project https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands
Add an autocomplete attribute with a value of username for usernames.
If you've implemented an "email first" sign-in flow that separates the username and password into two separate forms, include a form field containing the username in the form used to collect the password. You can, of course, hide this field via CSS if that's appropriate for your layout.
Add an autocomplete attribute with a value of current-password for the password field on a sign-in form.
Add an autocomplete attribute with a value of new-password for the password field on sign-up and change-password forms.
If you require the user to type their password twice during sign-up or password update, add the new-password autocomplete attribute on both fields.
<form id="login" action="signup.php" method="post">
<input type="text" autocomplete="new-password">
<input type="password" autocomplete="new-password">
<input type="submit" value="Sign Up">
</form>
推荐阅读
- android - Android Vitals 崩溃日志去混淆指向错误的行号
- node.js - 在将nodejs应用程序部署到生产之前删除所有console.log?
- c# - 如何使用 yamldotnet 启用解析 yaml,它接受同名的列表和键值对?
- android - 如何在 react-navigation-material-bottom-tabs 中添加标签栏的阴影?
- laravel - 如何限制 whereHas 只匹配 where 条件?
- java - 如何访问添加到尚未声明的 JPanel 的 swing 组件?
- c# - 从超类调用重载构造函数后要调用的强制方法
- android - 在 Android API Level 15+ 上进行 AES-GCM 加密
- android - 如何将文件从 Firebase 存储下载到自定义文件夹?
- android - 如何在应用程序中模仿设备的弯曲边缘?