Aless Hosry
Aless Hosry

Reputation: 1189

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

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

Upvotes: 17

Views: 11936

Answers (1)

Swrena
Swrena

Reputation: 330

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.

Upvotes: 2

Related Questions