自动完成=“新密码";不能正常工作,并“使用密码"下拉列表仍然显示 [英] Autocomplete = "new password" not working and "use password for" dropdown list still shown

查看:132
本文介绍了自动完成=“新密码";不能正常工作,并“使用密码"下拉列表仍然显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2010创建了一个登录表单,其中包含用于用户名的输入文本和用于userpass的类型密码输入.我具有最新的Chrome版本59.0.3071.115(正式版本)(32位). 下面是我的代码:

 <form id="form1" autocomplete="off" runat="server">
    <input id="Text1" type="text" name="text" runat="server" autocomplete="off" />
    <input id="Password1" type="password" name="password" runat="server" autocomplete="off" />
</form> 

问题在于,只有在chrome上,如果我单击任何这些输入,就会出现一个下拉列表,并在浏览器中显示我保存的通行证的一些建议.我想禁用此选项,所以我搜索并找到了此解决方案:

<input id="Password1" type="password" name="password" runat="server" 
         autocomplete="new-password" />

新密码将禁用自动填充功能,因为它将考虑到每次用户输入新密码都不需要,因此无需提出建议.但这并没有发生...实际上,当我添加用于输入密码的新密码时,下拉列表对于输入文本消失了,但对于输入密码仍然显示了 ...很奇怪...那么如何为两者输入禁用它?谢谢

解决方案

您可以通过添加两个隐藏的假字段以及在表单中添加autocomplete="off"并在主输入中添加autocomplete="none"来防止Chrome建议./p>

这是一个有效的示例:

<form id="form1" autocomplete="off" runat="server">

<input style="display:none" type="text" name="fakeusername"/>
<input style="display:none" type="password" name="fakepassword"/>

<input id="Text1" type="text" name="text" runat="server" autocomplete="none" /> 
<input id="Password1" type="password" name="password" runat="server" autocomplete="none" />

<input id="bb" type="submit" name="submit" />

</form>

Jsfiddle:: https://jsfiddle.net/wb20t08g/3/

注意:您需要删除以前保存过的Google chrome建议. ( Ctrl + Shift + del ).但是在那之后,如果您单击提交,那么如果您要保存密码或任何下拉列表中的建议,Chrome将不会显示任何弹出式提示.

I created a login form with input text for username and input of type password for userpass using visual studio 2010. I have the latest chrome Version 59.0.3071.115 (Official Build) (32-bit). Below is my code:

<form id="form1" autocomplete="off" runat="server">
    <input id="Text1" type="text" name="text" runat="server" autocomplete="off" />
    <input id="Password1" type="password" name="password" runat="server" autocomplete="off" />
</form>

the problem is that only on chrome if I click on any of those inputs a dropdown list appears with some suggestions of my saved pass on the browser. I want to disable this option so I searched and found this solution:

<input id="Password1" type="password" name="password" runat="server" 
         autocomplete="new-password" />

New password will disable autofill because it will take into consideration that each time user will enter a new pass, so no need for suggestions. But this is not happening here... actually when I added new password for input pass, the dropdown list disappeared for input text but still shown for input pass... Weird ... So how can I disable it for both inputs? Thanks

解决方案

You can prevent Chrome from suggesting by adding two hidden fake fields as well as adding the autocomplete="off" to the form and autocomplete="none" to the main inputs.

Here's a working sample:

<form id="form1" autocomplete="off" runat="server">

<input style="display:none" type="text" name="fakeusername"/>
<input style="display:none" type="password" name="fakepassword"/>

<input id="Text1" type="text" name="text" runat="server" autocomplete="none" /> 
<input id="Password1" type="password" name="password" runat="server" autocomplete="none" />

<input id="bb" type="submit" name="submit" />

</form>

Jsfiddle: https://jsfiddle.net/wb20t08g/3/

NOTE: You need to delete google chrome suggestions that have been saved there from before. (Ctrl + Shift + del). But after that if you click on submit, Chrome won't show any pop-up mentioning if you want to save the password or any dropdown for suggestions.

这篇关于自动完成=“新密码";不能正常工作,并“使用密码"下拉列表仍然显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆