Send Global keystroke using JavaScript in FireFox/Greasemonkey

后端 未结 2 547
谎友^
谎友^ 2021-01-20 21:16

I currently have a GM script that captures a keystroke and programmatically clicks an element on a webpage. However, this only works when the page/tab has focus. Is there an

相关标签:
2条回答
  • 2021-01-20 21:47

    Can you precede your GreaseMonkey script with a javascript call to window.focus()?

    0 讨论(0)
  • 2021-01-20 22:01

    This cannot be done in JS or Greasemonkey, by design. It used to be a huge security hole. You'll have to write an extension (add-on).

    Here are some add-on resources, I've found helpful:

    • Mozilla extensions home page
    • Add-on Builder
    • 10 Things They Never Tell You In Firefox Extension School
    • Developing Firefox Extensions – Paper
    0 讨论(0)
提交回复
热议问题