Is there a way to simulate a key press from a chrome extension? For example when I click the extension button I can specify that keys 'ABC' be sent to browser window.
Unfortunately no (it is a javascript problem, Chrome API doesn't provide any help).
All you can do is dispatch a keypress event (see this question for example), but you can't emulate actual button press. If parent page listens to keypress events, then it will catch it (this event won't have all the info as a real button press event, so it might still not work), otherwise nothing would happen.
Right now, you have to read the HTML5 spec and simulate everything that the browser would do. Here was my last attempt at it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With