1

Chrome Autofill my first textbox in every page with logged user name. I tried different method like

autocomplete="off"

But this is not working.

<asp:TextBox ID="txtSearch" runat="server" Width="200px" Text="" >

2 Answers2

1

I would suggest that you make a hidden Textbox with the name and id username or email.

Update: Chromium should be ashamed. Sadly, they didn't fix the problem and may do so in the near future. See the links below:

https://bugs.chromium.org/p/chromium/issues/detail?id=370363#c7

https://bugs.chromium.org/p/chromium/issues/detail?id=914451&can=2&q=Autofill%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

As a result, it seems the only practical, if not perfect, solution. Chromium ignores hidden TextBoxes (display: none) so it won't work. I suggest hiding the fake userName TextBox with zero width or height or positioning it outside the browser viewport.

This is an example:

<input type="text" id="username" name="username" style="position: fixed; font-size: 0px; width: 0px; height: 0px; top: -500px; left: -500px;" />
QMaster
  • 3,743
  • 3
  • 43
  • 56
Wowo Ot
  • 1,362
  • 13
  • 21
0

Code

Please make this as below in code behind.

txtSearch.Attributes.Add("autocomplete", "off");

you can check attached screenshot.