How do I get password fields to be autofilled without requiring user interaction?

后端 未结 1 837
暗喜
暗喜 2021-01-22 23:09

If I inspect an from my Tampermonkey script and observe changes using a change handler for a password field that is fi

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-22 23:59

    You cannot do this using Google's built-in password storage because, as you stated yourself, Chrome requires user interaction to enable such passwords -- as a security feature.

    Specifically, Chrome requires an event with the isTrusted property set to true. Tampermonkey cannot work around this because even Chrome extensions are not able to set the isTrusted property.

    See also, this related feature request from 2015.

    One solution is to use a password manager that fills these fields without using Google's built-in storage.
    There are many available, with varying degrees of cross-device, and cross-browser, support.

    Or you can write your own Tampermonkey script to fill in these fields, irregardless of what Chrome has stored.

    If you do write a Tampermonkey script, I recommend that you use a secure storage framework, don't hardcode login info into the script.

    0 讨论(0)
提交回复
热议问题