Google chrome autofilling all password inputs

后端 未结 9 1176
面向向阳花
面向向阳花 2021-02-02 08:09

My Problem

I must have turned on google to autofill for a login on my site, however it is trying to now autofill that login data whenever I want to edit

9条回答
  •  Happy的楠姐
    2021-02-02 09:05

    Sometimes even autocomplete=off would not prevent to fill in credentials into wrong fields, but not user or nickname field.

    Fix: browser autofill in by readonly-mode and set writable on focus

     
    

    (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

    Explanation: Browser auto fills credentials to wrong text field?

    @Samir: Chrome auto fills any input with a type of password and then whatever the input before it is

    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,

    This readonly-fix above worked for me.

提交回复
热议问题