How to disable Chrome autofill (after 2020)

3Dom picture 3Dom · Mar 15, 2020 · Viewed 7.8k times · Source

I've stumbled across this issue a couple of times in the last while, where Chrome ignores autocomplete="false" and autocomplete="off". It will now even ignore autocomplete="whatever" or anything you do to trick it, if someone has submitted a form with that random "hack" in it before.

In trying to solve this issue, I came across this StackOverflow question, which doesn't solve the problem if you've submitted a form containing this field before.

EDIT: This is NOT for password fields.

Answer

risutoru picture risutoru · Jan 18, 2021

I had this issue with a field that has "number" in the name and this triggering the CreditCard Autocomplete Dialog. This solution helped me get rid of it.

Even though this is not the intended use of the option, I think this is unlikely to break and works without JavaScript Hacks. A one time code won't trigger an autocomplete so I treat the fields that are not supposed to autocomplete as one time codes.

<input type="text" name="number" autocomplete="one-time-code" />

This did the trick for me. I tested it in Chrome 87.0.4280.141 and it works fine.