Google chrome autofilling all password inputs

后端 未结 9 1068
面向向阳花
面向向阳花 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条回答
  •  悲&欢浪女
    2021-02-02 09:10

    Chrome has updates, fake inputs are not working any more.

    Chrome seems to remember everything after an success 200 net connection, whatever input[type=password] is activated on the screen will be remembered.

    I've tried dynamically set the inputs to type text, clearing the contents, they don't always work, especially when there is a button to get verify code before submitting the form.

    Finally, I figured it out:

    listen to inputs focus and blur events,

    everytime blur:

    var psw1 = $('input[name=psw1]').val();
    $('input[name=psw1]').val((new Array(psw1.length)).join('*'));
    $('input[name=psw1]').attr('type', 'text');
    

    everytime focus:

    $('input[name=psw1]').attr('type', 'password');
    $('input[name=psw1]').val(psw1)
    

    the side effect is obvious, input's content would change every focus and blur event, but this method prevent chrome from remembering password perfectly.

提交回复
热议问题