Javascript Can't Read Chrome's Auto-fill Password Field Until The Page Is Interacted With By The User
Solution 1:
Solved my own problem!
If I put everything inside a form, and instead of listening for the "enter" keydown event, I just listened for the "submit" event on the form, then JavaScript could read the value of my password field.
Solution 2:
It is not possible to read the values until the user interacts with the page.
The reason is, that events have the isTrusted property. "The isTrusted read-only property of the Event interface is a Boolean that is true when the event was generated by a user action, and false when the event was created or modified by a script or dispatched via EventTarget.dispatchEvent()." (from https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted).
Chrome autofill values only become readable with a isTrusted=true event.
Note: window.scroll() always has isTrusted=true. But it doesnt make the autofill values readable!
Post a Comment for "Javascript Can't Read Chrome's Auto-fill Password Field Until The Page Is Interacted With By The User"