Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected Chrome Autofill Behaviour [disable chrome autofill]

So like everyone else before me I am trying to disable chrome autofill.

This explained to me why autocomplete off does not work:

A user agent may allow the user to override an element's autofill field name, e.g. to change it from "off" to "on" to allow values to be remembered and prefilled despite the page author's objections, or to always "off", never remembering values. However, user agents should not allow users to trivially override the autofill field name from "off" to "on" or other values, as there are significant security implications for the user if all values are always remembered, regardless of the site's preferences.

This should be the solution:

In some case, the browser will keep suggesting autocompletion values even if the autocomplete attribute is set to off. This unexpected behavior can be quite puzzling for developers. The trick to really force the no-completion is to assign a random string to the attribute

Default behavior

This is expected.

default autocomplete

Autocomplete off

This is also expected.

autocomplete off

Autocomplete as random string

The autocomplete is different but I still see it and it is coming from chrome. (I disabled my extensions, only turning autofill off in chrome settings prevented the autocomplete from showing up)

Can anyone please explain what is happening and how do I finally get rid of it? 🤯

EDIT:

In another input in the same form autocomplete="off" works and autocomplete="radnomString!23123adf" does not work. Setting autocomplete attribute to the form element didn't help. autocomplete="new-password" also didn't help.

autocomplete as random string

like image 895
Michal Avatar asked Nov 06 '18 19:11

Michal


People also ask

Can you disable Chrome autofill?

Click on "Settings." Choose "Privacy & Security." In the "Forms and Autofill" section uncheck the options for which you wish to disable Autofill. The system will automatically save your settings.

How do I stop Chrome from autofill reacting?

To turn off autocomplete on an input field in React, set the autoComplete prop to off or new-password , e.g. <input autoComplete="off" /> . When autoComplete is set to off , the browser is not permitted to automatically enter a value for the field.

How do I remove unwanted autofill?

Open "Settings" by clicking on the three dots icon and selecting it from the menu. Select the "Privacy & Security" tab on the left side of the page. Scroll down to "Clear Browsing Data" and select "Choose What to Clear." Select "Autofill data (includes forms and cards)" and click the "Clear" button.


2 Answers

As of recent Chrome (definitely version 70) autocomplete="off" is now respected, as long as your inputs do not look like user profile, address or credit card data.

On the other hand, values such as disabled, nope or random strings appear to be ignored.

It is likely Chrome is ignoring the autocomplete element because your input name is individualName. The autofill logic is done server-side by Google, so there are lots of heuristics involved.

like image 144
rjh Avatar answered Oct 18 '22 19:10

rjh


To add slightly to rjh's answer, Chrome isn't just looking at the name / id of the field you are looking to disable autocomplete. It is looking at the text near the text box. So if you have "Name: [txtRandomStringTextBox]" it will assume [txtRandomStringTextBox] is actually a name and it will continue to recommend autofill. Not sure of a work around for this.

Although their current implementation in Chrome 70 .0.3538.102 is less annoying, it would be nice if this was fully addressed.

like image 30
J.W. Avatar answered Oct 18 '22 17:10

J.W.