samala7800
samala7800

Reputation: 213

How to stop password autofill in HTML forms

How can I stop Chrome and Firefox from autofilling password fields if I have set autocomplete="off" and it still does not work?

Upvotes: 1

Views: 1169

Answers (2)

Liam
Liam

Reputation: 5486

Adding:

autocomplete="new-password" 

to your input field works - as per the docs:

https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Turning_off_form_autocompletion

Upvotes: 0

samala7800
samala7800

Reputation: 213

After almost a year of fighting this problem, I found through trial and error that Chrome and Firefox use absolute desperation to fill in these fields for you. The HTML tag autocomplete="off" is completely and almost criminally ignored (this is such a security concern I can't even..)

Here's a trick that should work: if you have a field that has anything to do with an email address (label, placeholder, name, ANYTHING imaginable) you must not place the password field under it. Place a hidden field or just re-organize your inputs so that passwords never follow emails. If these thirsty browsers even sense a "password-like" field under your email field (and presumably "account" field?) they will try and fill that second input field with your password.

Utter insanity requires equally stupid solutions.

Upvotes: 3

Related Questions