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 7611883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:46:22+00:00 2026-05-31T01:46:22+00:00

I am trying to create some sort of workflow in GreaseMonkey. I start with

  • 0

I am trying to create some sort of workflow in GreaseMonkey.
I start with GreaseMonkey defining jQuery if it isn’t already defined:

/*! jQuery v1.7.1 jquery.com | jquery.org/license */
if (typeof jQuery == 'undefined')
(function(a,b).......function(){return f})})(window); // packed version
jQuery.noConflict();
/*! end of jQuery */

Then, it periodically checks a web page (jQuery.ajax/type=get/url:window.location.href).
When some condition is met, a window is created using

var url = <some page on the same domain>
var opened = window.open(url, "XYZ");

The question is how to get a button on the opened window to click. Let’s say on the page there is a button

<input type="button" id="clickme"

I’ve tried the obvious such as

opened.document.getElementById('clickme').click()
jQuery(opened.document).find('#clickme').click()

But neither work. This is probably a GreaseMonkey issue so would like to see if anyone has something similar working. My current workaround is to set up another GreaseMonkey script against the opened url which clicks the button if window.name = ‘XYZ’.

  • 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-31T01:46:23+00:00Added an answer on May 31, 2026 at 1:46 am

    The question is pretty vague; I’m assuming you’re creating a window using window.open or something to that effect, and want to interact with the DOM inside.

    You should be able to use the reference to the newly-opened window as you would use the window variable in regular JavaScript:

    window.document.getElementById(...).doStuff(...)
    

    becomes

    var thatWindowReference = window.open(...);
    ...
    thatWindowReference.document.getElementById(...).doStuff(...)
    

    If you’ve got jQuery loaded inside the window, then you can do

    thatWindowReference.$('selector').doStuff(...)
    

    As for how to simulate a click on a button inside that window:

    thatWindowReference.document.getElementById('thatButton').click();
    

    or using jQuery:

    thatWindowReference.$('#thatButton').click();
    

    Edit: Without using jQuery from inside the new window (test it out on jsFiddle):

    var w = window.open('about:blank');
    w.document.write('<button id="test" onclick="alert(\'I was clicked\');">Hello</button>');
    $(w.document.body).find('#test').click();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create some sort of timeline view like in video editors: media
I am trying to create some charts of data (eg http://www.amibroker.com/ ). Is there
What I am trying to do is to create some sort of rooms(like a
I need some help in jQuery. What I'm trying to do is to create
Basically, I am trying to create some sort of 'high score' - I will
I'm trying to create some sort of many-to-one association. The basic premise is a
I'm trying to create some sort of remote application execution programs. The situation is
We're trying to implement some sort of Chess game and we have defined an
I am trying to create some sort of new filesystem for a PHP cache-serving
I'm trying to create some HtmlHelper extensions and ran into a bit of a

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.