[Greasemonkey] javascript scope between browsers

Aaron Boodman boogs at youngpup.net
Thu Oct 19 10:37:12 PDT 2006


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


More information about the Greasemonkey mailing list