Stop browser from auto filling the form username and password fields

Vijay-Coder picture Vijay-Coder · May 14, 2014 · Viewed 13.1k times · Source

In the Chrome browser, I have saved the username and the password.

Now, if I navigate to some other form and it contains the username and password for some other stuff, the one I saved is auto-populated here.

How can I stop this?

Answer

AK Square Infomedia picture AK Square Infomedia · May 11, 2016

When autocomplete=off would not prevent to fill in credentials, use following -

fix browser autofill in: readonly and set writeble on focus (click and tab).

 <input type="password" readonly onfocus="this.removeAttribute('readonly');" onblur="this.setAttribute('readonly','');"/>