Unexpected Chrome Autofill Behaviour [disable chrome autofill]
Asked Answered
T

4

7

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

Tenderhearted answered 6/11, 2018 at 19:57 Comment(0)
P
5

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.

Plumber answered 7/11, 2018 at 16:18 Comment(4)
Sorry I have Chrome version 70.0.3538.110 and autocomplete="off" doesn't work, while "nope" better works. Strange. I also tested with Chrome 69. – Tyrus
@barbara.post, make sure you have unique 'name' attribute for each input. – Doviedow
Also, I need to emphasise that Chrome actually calls out to Google servers to ask if it should autofill. So the logic can change at any time! – Plumber
autocomplete=off only addresses autocomplete issue. Autofill suggestion still appears on Chrome 71 – Breastwork
B
3

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.

Berton answered 13/11, 2018 at 21:55 Comment(0)
C
0

I had same problem on windows Chrome.
Chrome ignored my settings about autocomplete and do evil things.

On my computer with Chrome version 70+ work fine with new saved passwords but on computer which had passwords created before Chrome version 70 not work as expected.
After created new and delete password and other many things with settings and whatever, my fellow clear Chrome cache from AppData. Now it works as expected like computer one.

Its seem like changes in Chrome 70 with new feature respect autocomplete=off does not refresh cache with old stored passwords. (THX for info @rjh)

SOLUTION IS DELETE CHROME CACHE FROM

C:\Users\<yourUser>\AppData\Local\Google\Chrome

Hope it helps.

Championship answered 22/1, 2019 at 23:45 Comment(3)
SOLUTION IS DELETE CHROME CACHE FROM 🀣I don't think that will work for people who use my website. – Tenderhearted
@Tenderhearted I understand. I have web product and my customers was big trouble with that. And I am not saying its good but its Chrome update bug and this solve my problem after 3 days find solution. I hope it helps someone. – Championship
Version 76.0.3809.87 here, this solution doesn't work. After deleting my User Data, restarting Chrome and saving my credentials again I still have them prefilled in random fields – Dehypnotize
A
0

To prevent autofill (not autocomplete), I used the following trick:

<form>
  <input
    name="username"
    type="text"
    style="opacity: 0; position: fixed; width: 0; height: 0"
  />
  <input
    type="password"
    style="opacity: 0; position: fixed; width: 0; height: 0"
  />

  <input name="username" type="text" />
  <input type="password" />
</form>
Anemo answered 10/1, 2022 at 16:7 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.