Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop browser from auto filling the form username and password fields

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?

like image 838
Vijay-Coder Avatar asked May 14 '14 06:05

Vijay-Coder


People also ask

How do I turn off auto complete for forms and username password forms?

Add autocomplete="off" onto <form> element; Add hidden <input> with autocomplete="false" as a first children element of the form.

How do I turn off autocomplete on password field?

Preventing autofilling with autocomplete="new-password" If you are defining a user management page where a user can specify a new password for another person, and therefore you want to prevent autofilling of password fields, you can use autocomplete="new-password" .


3 Answers

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','');"/>
like image 90
AK Square Infomedia Avatar answered Oct 04 '22 04:10

AK Square Infomedia


For Fire fox browser use this:

<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<input type="password" name="password" id="password" value="" />

For Chrome browser: use autocomplete="new-password"

like image 37
Raymond Morphy Avatar answered Oct 04 '22 03:10

Raymond Morphy


Please refer to the following:
https://www.chromium.org/developers/design-documents/create-amazing-password-forms and https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands

Try the following :

<form id="login" action="signup.php" method="post">
    <input type="text" autocomplete="username">
    <input type="password" autocomplete="new-password">
    <input type="password" autocomplete="new-password">
    <input type="submit" value="Sign Up!">
</form>
like image 29
Amitabh Das Avatar answered Oct 04 '22 03:10

Amitabh Das