[Greasemonkey] Excluding iframes,
etc from triggering my greasemonkey script?
Vectorspace
vectorspace at ntlworld.com
Sat Apr 8 23:02:14 EDT 2006
Never mind, I worked it out about 5 seconds later...
document.getElementsByTagName("frame")[x].contentDocument...
I really should took harder before posting here... :)
Vectorspace wrote:
> To expand on that, how can I make a script scan for and access the DOM
> of sub frames?
> I know I can access the DOM of a sub frame with
> window.frame_name.document.... but how do I do that if I do not know
> their names? I tried
> document.getelementsByTagName("frame")[x].document... but that didn't
> work.
> I have a script that runs on all pages, and I would like to be able to
> control it directly through GM_registerMenuCommand() menu items but
> those items do not appear for scripts running on sub frames. So, if I
> can have a script access the DOM of any sub frames I can have it only
> run on the top page and access the sub frames itself.
>
> Lenny Domnitser wrote:
>> On 4/8/06, Jonas Lundberg <my.name.is.hans at gmail.com> wrote:
>>
>>> My greasemonkey script is not only triggered when the page is first
>>> loaded, it is also triggered by each iFrame on the page that loads
>>> html documents.
>>> Is there any way to avoid this?
>>>
>>
>> For site-specific scripts, tune your @include.
>>
>> If you want an "@include *" script that only runs in the top window,
>> use something like:
>>
>> if(top == self) {
>> // the script
>> }
>> _______________________________________________
>> Greasemonkey mailing list
>> Greasemonkey at mozdev.org
>> http://mozdev.org/mailman/listinfo/greasemonkey
>>
>>
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>
More information about the Greasemonkey
mailing list