Uma*_*air 16 html html5 google-chrome
我知道它在SO上已被多次回答,但这适用于旧版本的Chrome.
我有Chrome版本53.0.2785.143.
我想禁用Chrome以自动填充密码字段,
我已经尝试了旧的SO答案中提到的所有方法,
方法1:
尝试使用假用户名密码.
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
Run Code Online (Sandbox Code Playgroud)
方法2:
尝试使用autocomplete='new-password'和autocomplete='false'和autocomplete='off'
但它都不起作用.
Sac*_*ith 22
试试这个 display:none
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<input type="password" name="password" id="password" value="" />
Run Code Online (Sandbox Code Playgroud)
你也可以jQuery用来解决这个问题,希望这会对你有所帮助,如果没有请在这里发表评论,祝你好运:)
更新:
这取决于chrome版本,有时这对chrome新版本不起作用,所以你应该尝试很多东西来防止这个问题,也尝试这些代码片段并请发表评论发生了什么:)
解决方案2
$('form[autocomplete="off"] input, input[autocomplete="off"]').each(function () {
var input = this;
var name = $(input).attr('name');
var id = $(input).attr('id');
$(input).removeAttr('name');
$(input).removeAttr('id');
setTimeout(function () {
$(input).attr('name', name);
$(input).attr('id', id);
}, 1);
});
Run Code Online (Sandbox Code Playgroud)
它从元素中删除"name"和"id"属性,并在1ms后将其分配回来.把它放在文件准备好了.
解决方案3
<input type="text" name="email">
<input type="password" name="password" autocomplete="new-password">
Run Code Online (Sandbox Code Playgroud)
经过测试并可在Chrome 53中使用
解决方案4
尝试autocomplete="false"而不是autocomplete="off"或nofill
RAG*_*OSE 12
根据 Mozilla 文档,在大多数现代浏览器中,将自动完成设置为“关闭”不会阻止密码管理器询问用户是否要保存用户名和密码信息,或自动填写站点登录表单中的这些值。
你必须使用
autocomplete = "new-password"
Run Code Online (Sandbox Code Playgroud)
创建新帐户或更改密码时,这应该用于“输入您的新密码”或“确认新密码”字段,而不是可能存在的一般“输入您的当前密码”字段。浏览器可以使用它来避免意外填写现有密码并帮助创建安全密码
您可以在此处查看所有自动完成值以供参考和更好地理解。
Dan*_*íaz 12
我也遇到了这个问题,截至 2020 年 5 月 22 日,我找不到一种方法让我的 web 应用程序避免填写密码字段,所以我找到了替代方案,如下:
在用户输入密码的输入字段上,将其类型更改为文本,这将避免弹出应用程序的所有已保存密码,然后通过添加以下内容来设置输入样式,使其看起来像传统的密码输入:
style="text-security:disc; -webkit-text-security:disc;"
Run Code Online (Sandbox Code Playgroud)
就像更改一样简单:
<input type="password">
Run Code Online (Sandbox Code Playgroud)
到:
<input type="text" style="text-security:disc; -webkit-text-security:disc;">
Run Code Online (Sandbox Code Playgroud)
甚至更多,您可以省略 type 属性:
<input style="text-security:disc; -webkit-text-security:disc;">
Run Code Online (Sandbox Code Playgroud)
干杯!
正如评论中指出的,此解决方案不适用于 Firefox,请参阅https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-security,尽管最初的问题仅询问对于Chrome上的解决方案,我找到了一个新的解决方案(不确定是否对每个人都有用):我创建了一种仅由磁盘组成的字体(模拟密码字段)并且似乎有效,请注意,我不是创建字体的专家, 我尽力了。我没有仔细测试这个解决方案,但乍一看似乎可以完成这项工作。链接到我使用 Font Forge 制作的字体:https://drive.google.com/file/d/1xWGciDI-cQVxDP_H8s7OfdJt44ukBWQl/view ?usp=sharing
请测试一下并让我知道它是否有效。
将 ttf 文件放在创建 html 文件的同一目录中
<!DOCTYPE html>
<html>
<head>
<title>Font Test</title>
</head>
<body>
<span>Custom font</span><input class="disk-font" type="text"/>
<span>Normal Font</span><input type="password"/>
</body>
<style>
@font-face {
font-family: disks;
src: url(disks.ttf);
}
.disk-font{
font-family: disks;
}
</style>
</html>
Run Code Online (Sandbox Code Playgroud)
小智 -11
你可以试试这个方法。
\n\n关闭自动填充\n如果您不想\xe2\x80\x99 每次填写表单时都看到保存的个人信息,则可以关闭自动填充。
\n\n打开 Chrome。\n在右上角,单击“更多”,然后单击“设置”。
\n\n单击底部的“显示高级设置”。
\n\n在“密码和表单”下,取消选中“启用自动填充,只需单击一下即可填写 Web 表单”。\n要重新打开自动填充,请再次选中该框。
\n| 归档时间: |
|
| 查看次数: |
25435 次 |
| 最近记录: |