Stopping Chrome from ignoring autocomplete=off

Autofill (or autocomplete) attributes tell browsers to automatically fill out an answer for the user if the user has stored that information in the browser.
And this little feature saves users well over a million days per month .
But there’s a problem …


This content originally appeared on Adam Silver and was authored by Adam Silver

Autofill (or autocomplete) attributes tell browsers to automatically fill out an answer for the user if the user has stored that information in the browser.

And this little feature saves users well over a million days per month .

But there’s a problem with Chrome: it sometimes ignores autocomplete="off".

Now even though this is annoying, it might be the right thing to do and it may also be abiding by the specification.

The autocomplete content attribute can be used to hint to the user agent how to, or indeed whether to, provide such a feature.

This is because with HTML, this attribute (like any other), is a suggestion to the browser.

To make things a little more complicated, browsers may also autofill form fields based on the field’s name or id attributes.

This is how browsers did it before the autocomplete attribute came along.

So for maximum support use both the name and autocomplete attributes.

But if you want Chrome (and other browsers) to stop autofilling fields then you need to use a name, id and autocomplete value that the browser doesn’t recognise.

<input
  name="xyz123"
  id="xyz123"
  autocomplete="xyz123"
>

As a side note: Chrome will correctly not autofill a ‘create password’ field if you use these attributes:

<input
  name="new-password"
  id="new-password"
  autocomplete="new-password"
>

As above, this could have still been achieved with a random value, but it’s nice to have a readable field name.

Maybe a prefix of new- should become the readable convention for browsers to ignore autofill?


This content originally appeared on Adam Silver and was authored by Adam Silver


Print Share Comment Cite Upload Translate Updates
APA

Adam Silver | Sciencx (2021-02-04T00:00:00+00:00) Stopping Chrome from ignoring autocomplete=off. Retrieved from https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/

MLA
" » Stopping Chrome from ignoring autocomplete=off." Adam Silver | Sciencx - Thursday February 4, 2021, https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/
HARVARD
Adam Silver | Sciencx Thursday February 4, 2021 » Stopping Chrome from ignoring autocomplete=off., viewed ,<https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/>
VANCOUVER
Adam Silver | Sciencx - » Stopping Chrome from ignoring autocomplete=off. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/
CHICAGO
" » Stopping Chrome from ignoring autocomplete=off." Adam Silver | Sciencx - Accessed . https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/
IEEE
" » Stopping Chrome from ignoring autocomplete=off." Adam Silver | Sciencx [Online]. Available: https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/. [Accessed: ]
rf:citation
» Stopping Chrome from ignoring autocomplete=off | Adam Silver | Sciencx | https://www.scien.cx/2021/02/04/stopping-chrome-from-ignoring-autocompleteoff/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.