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

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

问题描述

我使用 Visual Studio 2010 创建了一个带有用户名输入文本和 userpass 类型密码输入的登录表单.我有最新的 chrome 版本 59.0.3071.115(官方版本)(32 位).下面是我的代码:

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>

问题是,只有在 chrome 上,如果我点击这些输入中的任何一个,才会出现一个下拉列表,其中包含我在浏览器上保存的传递的一些建议.我想禁用这个选项,所以我搜索并找到了这个解决方案:

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

推荐答案

您可以通过添加两个隐藏的假字段以及将 autocomplete="off" 添加到表单和autocomplete="none" 到主要输入.

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.

这是一个工作示例:

<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/

注意:您需要删除之前保存在那里的谷歌浏览器建议.(Ctrl + Shift + del).但是之后如果您点击提交,Chrome 将不会显示任何提示您是否要保存密码的弹出窗口或任何建议的下拉菜单.

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天全站免登陆