Monday, May 20, 2024
37
rated 0 times [  44] [ 7]  / answers: 1 / hits: 22756  / 13 Years ago, thu, june 9, 2011, 12:00:00

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.


More From » google-chrome

 Answers
6

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.


[#91786] Wednesday, June 8, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradleymoisesy

Total Points: 121
Total Questions: 105
Total Answers: 95

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
bradleymoisesy questions
Wed, Dec 22, 21, 00:00, 2 Years ago
Tue, Jun 1, 21, 00:00, 3 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;