[Greasemonkey] reading document tree of iframe

James Cowan cowanj at freenet.co.uk
Wed Aug 9 12:01:43 EDT 2006


thanks for the replies. I will take a look at the dojo solution.

There are a few things I do not understand about greasemonkey.

Assuming a greasemonkey script runs on all pages (includes *), does it run 
before or after the page is loaded?

Can a script within a normal web page call a greasemonkey script or vice 
versa? I guess a normal script can only call the window.GM_* functions but 
not functions defined in a gm script. Can a gm script call a function 
defined in a normal web page?

James

----- Original Message ----- 
From: "Johan Sundström" <oyasumi at gmail.com>
To: <greasemonkey at mozdev.org>
Sent: Tuesday, August 08, 2006 9:29 PM
Subject: Re: [Greasemonkey] reading document tree of iframe


On 8/8/06, Aaron Boodman <zboogs at gmail.com> wrote:
> Yeah, Greasemonkey runs in the same reduced permission land that
> regular webpages do, which means that it cannot reach across frames
> from different domains.
>
> You might be able to do what you want akwardly by writing two scripts
> -- one for the iframe domain and one for parent document domain.

Or, if you do it using the same script (set to listen to both URL:s,
and differentiating on which location was loaded to run either branch
of the script), you could abuse GM_setValue and GM_getValue to
establish an elaborate communication protocol between the two frames
and GM script environments, aided by a polling setTimeout loop to pass
and listen to values between the two branches.

*Very* awkward, but doable, in a proof-of-concept kind of way.

-- 
 / Johan Sundström, http://ecmanaut.blogspot.com/
_______________________________________________
Greasemonkey mailing list
Greasemonkey at mozdev.org
http://mozdev.org/mailman/listinfo/greasemonkey 



More information about the Greasemonkey mailing list