Chrome extension send key

Is there a way to simulate a keystroke with a chrome extension? For example, when I click the extension button, I can indicate that the “ABC” keys will be sent to the browser window.

+4
source share
2 answers

Unfortunately no (this is a javascript issue, the Chrome API does not provide any help).

All you can do is send a keypress event (see this question , for example), but you cannot emulate the actual keypress. If the parent page listens for keystroke events, then it will catch it (this event will not contain all the information as a real button press event, so it may still not work), otherwise nothing will happen.

+3
source

Now you need to read the HTML5 specification and simulate everything the browser does. Here is my last attempt:.

+1
source

All Articles