Posted about 8 years ago. Visible to the public.

Chrome 34+, Firefox 38+, IE11+ ignore autocomplete=off

Since version 34, Chromium/Chrome ignores the autocomplete="off" attribute on forms or input fields. Recent versions of other browser do the same, although implementation details vary.

This is especially problematic for admin areas because Chrome might automatically fill in a password on a "add new user" forms.

Chrome developers say this is by design Archive as they believe it encourages users to store more complex passwords.

For exactly this use case, Chrome and Firefox now allow to mark password fields with an attribute autocomplete="new-password". This will prevent the field to be filled in automatically.

Old workaround, possibly still necessary for IE

A possible workaround is to add invisible fields Archive to the form. Note that the invisible fields will still be filled in:

Copy
<input type="text" name="email" value="" style="display: none" /> <input type="text" name="email" value="Alice"/> <input type="text" name="not-an-email" value="" style="display: none" /> <input type="password" name="password" value="" style="display: none" /> <input type="password" name="password" value=""/>

Once there were extra hidden fields, Chrome stopped messing with my "real" input fields.
The not-an-email input might be necessary for Firefox, since it will sometimes expect a text field preceding a password field to be the username or email.

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
over 4 years ago
by Tobias Kraze
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more