[Greasemonkey] javascript scope between browsers
James Cowan
cowanj at freenet.co.uk
Fri Oct 20 03:37:33 PDT 2006
I cannot get this to work. It is not a function within the window I want to
call but within the firefox extension or gm script (basically extension
based ipc).
In some circumstances I can do a setTimeout call and it works.
For example in the child window I can do
window.opener.setTimeout("Somefunction()", 1) and it works
In the parent window childWdw.setTimeout("Somefunction()", 1) does not work.
James
----- Original Message -----
From: "Aaron Boodman" <boogs at youngpup.net>
To: <greasemonkey at mozdev.org>
Sent: Thursday, October 19, 2006 6:37 PM
Subject: Re: [Greasemonkey] javascript scope between browsers
> On 10/19/06, Anthony Lieuallen <arantius at gmail.com> wrote:
>> On 10/19/2006 9:07 AM, James Cowan wrote:
>> > I am puzzled by javascript scope within greasemonkey...
>> > Is there any way around this?
>>
>> (Not intentionally rude but...) Learn how greasemonkey works. A good
>> place to start:
>> http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html
>
> If you want to call functions in the child window, then you need either:
>
> wdw.unsafeWindow.someFunction();
>
> or:
>
> wdw.location.href = "javascript:someFunction()"
>
> The second is actually preferred, for security reasons.
>
> - a
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
More information about the Greasemonkey
mailing list