htmlgoogle-chromeautocompletew3c

Autocomplete off vs false?


Recently I have come across an issue where I wanted to disable auto-complete in all browsers.

Chrome has a new feature in settings where you can add a card number. And the requirement was to also disable that.

What worked in all browsers was to do this autocomplete=false at form level.

But this is not compliant with w3 rules, where they enforce to have autocomplete=off|on.

Can someone please explain to me why false works in all browsers?

even ie8, all firefox, safari etc., but it is not compliant.


Solution

  • You are right. Setting the autocomplete attribute to "off" does not disable Chrome autofill in more recent versions of Chrome.

    However, you can set autocomplete to anything besides "on" or "off" ("false", "true", "nofill") and it will disable Chrome autofill.

    This behavior is probably because the autocomplete attribute expects either an "on" or "off" value and doesn't do anything if you give it something else. So if you give it something other than those values, autofill falls apart/doesn't do anything.

    With the current version of Chrome it has been found that setting the autocomplete attribute to "off" actually works now.

    Also, I have found that this only works if you set the autocomplete attribute in each <input> tag of the form.

    There has been a response to this ambiguity in the Chromium bug listings here.

    Disclaimer: This was found to be true in Chrome version 47.0.2526.106 (64-bit)