Chrome ignores autocomplete=“off”

后端 未结 30 2210
礼貌的吻别
礼貌的吻别 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 01:08

    Browser does not care about autocomplete=off auto or even fills credentials to wrong text field?

    I fixed it by setting the password field to read-only and activate it, when user clicks into it or uses tab-key to this field.

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

     
    

    Update: Mobile Safari sets cursor in the field, but does not show virtual keyboard. New Fix works like before but handles virtual keyboard:

    
    

    Live Demo https://jsfiddle.net/danielsuess/n0scguv6/

    // UpdateEnd

    By the way, more information on my observation:

    Sometimes I notice this strange behavior on Chrome and Safari, when there are password fields in the same form. I guess, the browser looks 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 control it, sometimes even autocomplete=off would not prevent to fill in credentials into wrong fields, but not user or nickname field.

提交回复
热议问题