Charley Baker
Charley Baker

Reputation: 45

Remove Chrome autofill for HTML forms

I have created a simple form in HTML which has two fields: Username and Password, and then a Log in button. When I run the page in Chrome it fills the two fields with my XAMPP-phpmyadmin username and password into the fields and highlights them yellow. How can I completely remove this so they are blank. Thanks

HTML form code:

<html>


    <form action= "entryformlogon.php" method = "post" autocomplete="off">
            Username: <input type="text" name="Username"><br>
            Password: <input type="password" name="Password"><br>
                      <input type="submit" value="Log in">
    </form>


</html>

Upvotes: 1

Views: 1371

Answers (3)

S.Maina
S.Maina

Reputation: 11

For latest version of chrome

<input type="password" name="whatever" autocomplete="new-password" />

older version

<input type="password" name="whatever" autocomplete="false" />

or

<input type="password" name="whatever" autocomplete="off" />

Upvotes: 0

dsuess
dsuess

Reputation: 5347

Chrome it fills the two fields with my XAMPP-phpmyadmin username and password into the fields and highlights them yellow. How can I completely remove this so they are blank. @Charley Baker

This readonly-fix worked for me:

fix browser autofill in: readonly and set writeble on focus (at mouse click and tabbing through fields)

 <input type="password" readonly  
     onfocus="$(this).removeAttr('readonly');"/>

By the way, some more information on Chrome and Safari auto fill behaviour:

Sometimes even autocomplete=off would not prevent to fill in credentials into wrong fields, but not user or nickname field. I guess, the Chrome and Safari look for a password field to insert your saved credentials. Then it autofills username into the nearest textlike-input field , that appears prior the password field in DOM (just guessing due to observation). As the browser is the last instance and you can not directly control it, but the read-only trick above fixes it. :-)

Upvotes: 0

Alex Hill
Alex Hill

Reputation: 711

autocomplete= "off" must be added to every input element. i.e.

<input type="text" name="Username" autocomplete="off">

Upvotes: 1

Related Questions