Including other JS files and using "class" and custom styles

View: New views
5 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Re: [Greasemonkey] javascript scope between browsers

by jamescowan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am guessing but I think this article may be saying it is not possible - is
that right?

James

----- Original Message -----
From: "Anthony Lieuallen" <arantius@...>
To: <greasemonkey@...>
Sent: Thursday, October 19, 2006 3:18 PM
Subject: Re: [Greasemonkey] javascript scope between browsers


> 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
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey@...
> http://mozdev.org/mailman/listinfo/greasemonkey 

_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey

Re: [Greasemonkey] javascript scope between browsers

by Aaron Boodman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/19/06, Anthony Lieuallen <arantius@...> 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@...
http://mozdev.org/mailman/listinfo/greasemonkey

Re: [Greasemonkey] javascript scope between browsers

by Anthony Lieuallen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/19/2006 12:10 PM, James Cowan wrote:
> I am guessing but I think this article may be saying it is not
> possible - is that right?

It's possible.  It's not safe.  Potential privacy and security issues.
Use unsafeWindow to communicate with the content document.
_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey

Re: [Greasemonkey] javascript scope between browsers

by jamescowan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
To: <greasemonkey@...>
Sent: Thursday, October 19, 2006 6:37 PM
Subject: Re: [Greasemonkey] javascript scope between browsers


> On 10/19/06, Anthony Lieuallen <arantius@...> 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@...
> http://mozdev.org/mailman/listinfo/greasemonkey 

_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey

Re: [Greasemonkey] javascript scope between browsers

by WillBo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In the parent window try

window.setTimeout("childWdw.Somefunction()", 1)

_______________________________________________
Greasemonkey mailing list
Greasemonkey@...
http://mozdev.org/mailman/listinfo/greasemonkey
< Prev | 1 - 2 | Next >