Autocomplete = "new password" not working and "use password for" dropdown list still shown

AlessHo picture AlessHo · Jul 27, 2017 · Viewed 9.1k times · Source

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:

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

Answer

Sorena picture Sorena · May 3, 2018

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.