Chrome autofills username into random text input Chrome autofills username into random text input google-chrome google-chrome

Chrome autofills username into random text input


The answer is to add an invisible text input to the asp.net form called "username".

Several years ago we were having the same problem with a different input. The answer was to add an invisible input of type "password", as explained in this SO answer, scroll down to the phrase "It is so simple and tricky...":

Disabling Chrome Autofill

Below is the complete fix, I added these two elements inside the form element in our site's master page. Per @Jeff_Mergler's comment below, put these inputs at the top of your form tag:

<input type="text" id="username" style="width:0;height:0;visibility:hidden;position:absolute;left:0;top:0" /><input type="password" style="width:0;height:0;visibility:hidden;position:absolute;left:0;top:0" />


Some more ways to try to workaround this:

  • Add autocomplete="off" to the <form> and/or to the <input>
  • Change the field's name/idto something that does not have "name" or "user" in it
  • If it is not already inside <form> wrap the element with empty <form> tag
  • Randomize the name attribute of the input, or use data-name instead of name. You'll have to change the code that process the data accordingly.

Also I think it'll help to report this issue to Google via ⋮→Help→Report an issue (or Alt+Shift+I) to encourage them to fix these issues.


I was facing the same issue, i found a fix by wrapping my div inside a form tag and added a property autocomplete="off" in the form tag.

...........