Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6091341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:18:58+00:00 2026-05-23T12:18:58+00:00

I currently have a GM script that captures a keystroke and programmatically clicks an

  • 0

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 any way to capture the keystroke from the second page/tab and apply the click to an element on the first page/tab? I know I can get a reference to another window by opening it in JavaScript. However, I can’t access elements in that window if it is on another domain. If I cannot do this using Greasemonkey, any suggestions on how to accomplish it as an extension instead of a GM script. Really, this question is more how to get a reference to an open tab/window in a GM script, or as an extension.

Here is the sample code I’m working with:

function dispatchMouseEvent(target, event) {

  var e = document.createEvent("MouseEvents");
  e.initMouseEvent(event, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  
  target.dispatchEvent(e);

};

function mouseClick(element) {

    dispatchMouseEvent(element, 'mouseover');
    dispatchMouseEvent(element, 'mousedown');
    dispatchMouseEvent(element, 'click');
    dispatchMouseEvent(element, 'mouseup');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:18:59+00:00Added an answer on May 23, 2026 at 12:18 pm

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL script that inserts data (via INSERT statements currently numbering in
I have a SQL script that is being executed in TOAD. Currently, I have
Summary I currently have a NAnt build script that performs a vssget on either
Currently im faced with the following problem: I have a script that searches through
I have this script that I'd like to in addition save as a xls
I currently have a perl script that imports HTML and converts it to plain
I have a bash script that creates a Subversion patch file for the current
I have some mod_rewrite rewrites that correctly redirect the URLs to a script. From
I'm currently experimenting with build script, and since I have an ASP.net Web Part
I currently have an MS Access application that connects to a PostgreSQL database via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.