I've created a web application which uses a tagbox drop down. This works great in all browsers except Chrome browser (Version 21.0.1180.89).
Despite both the input
fields AND the form
field having the autocomplete="off"
attribute, Chrome insists on showing a drop down history of previous entries for the field, which is obliterating the tagbox list.
I just updated to Chrome 49 and Diogo Cid's solution doesn't work anymore.
I made a different workaround hiding and removing the fields at run-time after the page is loaded.
Chrome now ignores the original workaround applying the credentials to the first displayed
type="password"
field and its previoustype="text"
field, so I have hidden both fields using CSSvisibility: hidden;
I know that it may seem not very elegant but it works.
i found this solution to be the most appropriate:
It must be loaded after dom ready, or after the form renders.
Modern Approach
Simply make your input
readonly
, and on focus, remove it. This is a very simple approach and browsers will not populatereadonly
inputs. Therefore, this method is accepted and will never be overwritten by future browser updates.The next part is optional. Style your input accordingly so that it does not look like a
readonly
input.WORKING EXAMPLE
It appears that Chrome now ignores
autocomplete="off"
unless it is on the<form autocomplete="off">
tag.Seen chrome ignore the
autocomplete="off"
, I solve it with a stupid way which is using "fake input" to cheat chrome to fill it up instead of filling the "real" one.Example:
Chrome will fill up the "fake input", and when submit, server will take the "real input" value.
I am posting this answer to bring an updated solution to this problem. I am currently using Chrome 49 and no given answer work for this one. I am also looking for a solution working with other browsers and previous versions.
Put this code on the beginning of your form
Then, for your real password field, use
Comment this answer if this is no longer working or if you get an issue with another browser or version.
Approved on: