Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Chrome to autofill username/email password?

I know its been answered many times on SO but that is for older versions of Chrome.

I have Chrome Version 53.0.2785.143.

I want to disable Chrome to autofill password fields,

I have tried all methods mentioned in older SO answers,

Method 1:

Tried using fake username passwords.

<input style="display:none" type="text" name="fakeusernameremembered"/> <input style="display:none" type="password" name="fakepasswordremembered"/> 

Method 2:

Tried using autocomplete='new-password' and autocomplete='false' and autocomplete='off'

But none of it works.

like image 500
Umair Ayub Avatar asked Oct 23 '16 06:10

Umair Ayub


People also ask

How do I disable autofill username and password in Chrome?

To stop Chrome from asking to save your passwords: Click the Chrome menu in the toolbar and choose Settings. Click Autofill > Passwords. Turn off “Offer to save passwords”.

How do I get rid of username suggestions in Chrome?

To delete all other usernames, click the "Chrome" button, select "Tools," click "Clear Browsing Data" and check the box next to "Clear Saved AutoFill Form Data." Then set the time range to "The Beginning of Time" and click "Clear Browsing Data."

How do I turn off Autocomplete on password field?

Preventing autofilling with autocomplete="new-password" If you are defining a user management page where a user can specify a new password for another person, and therefore you want to prevent autofilling of password fields, you can use autocomplete="new-password" .


2 Answers

Try this 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="" /> 

You can also use jQuery to solve this problem,hope this will be helped to you,if not please put a comment here,good luck :)

Update:

This is depend on chrome version,sometimes this will be not work for chrome new versions,so you should have try many things to prevent this problem,try these code snippets also and please put a comment what happened :)

Solution 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);             }); 

It removes "name" and "id" attributes from elements and assigns them back after 1ms. Put this in document get ready.

Solution 3

<input type="text" name="email"> <input type="password" name="password" autocomplete="new-password"> 

Tested and works in Chrome 53

Solution 4

try autocomplete="false" instead of autocomplete="off" or nofill

like image 115
Sachith Wickramaarachchi Avatar answered Oct 10 '22 13:10

Sachith Wickramaarachchi


According to Mozilla doc, In most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form.

you have to use

autocomplete = "new-password" 

When creating a new account or changing passwords, this should be used for an "Enter your new password" or "Confirm new password" field, as opposed to a general "Enter your current password" field that might be present. This may be used by the browser both to avoid accidentally filling in an existing password and to offer assistance in creating a secure password

You can see all autocomplete values here for reference and better understanding.

like image 30
RAGINROSE Avatar answered Oct 10 '22 13:10

RAGINROSE