Chrome ignores autocomplete=“off”

后端 未结 30 1511
礼貌的吻别
礼貌的吻别 2020-11-22 00:42

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

30条回答
  •  [愿得一人]
    2020-11-22 00:56

    Whilst I agree autocomplete should be a user choice, there are times when Chrome is over-zealous with it (other browsers may be too). For instance, a password field with a different name is still auto-filled with a saved password and the previous field populated with the username. This particularly sucks when the form is a user management form for a web app and you don't want autofill to populate it with your own credentials.

    Chrome completely ignores autocomplete="off" now. Whilst the JS hacks may well work, I found a simple way which works at the time of writing:

    Set the value of the password field to the control character 8 ("\x08" in PHP or  in HTML). This stops Chrome auto-filling the field because it has a value, but no actual value is entered because this is the backspace character.

    Yes this is still a hack, but it works for me. YMMV.

提交回复
热议问题