I am going to write an FF plugin that will alter certain page
contents. Recently I discovered that GreaseMonkey is perfect for such
things.
However, there are many pages that contain <IFRAME> elements, which
are actually other nested pages. Does anybody know how exactly
GreaseMonkey processes such nested pages?
Will it call my javascript for the main page only, or for every IFRAME
too? What will happen if I re-assing the entire
document.body.innerHTML property? Will the page be re-processed by
GreaseMonkey in that case? What if the reassigned HTML contains
IFRAMES - will they be reloaded and processed again?
I am not really going to do exactly these things, but I need a better
understanding how GreaseMonkey works.
Best regards,
Vortexx.
Every frame, "I" or not is a page. They all get hit.
> What will happen if I re-assing the entire document.body.innerHTML
> property? Will the page be re-processed by GreaseMonkey in that case?
Er .. re-assigning? No. Only on document load.
> What if the reassigned HTML contains IFRAMES - will they be reloaded
> and processed again?
A new frame is a new document to load, so yes.
Long and short is, if it generates an onload event (really:
DOMContentLoaded, because that's a bit earlier), GM will evaluate it.
If not, not.
http://www.blah.com - a web page
http://www.blah.com/foo - a frame, iframe., or object in the page
http://www.blah.com/goo - another frame, iframe., or object in the page
http://www.wingo.com - another frame, iframe, or object on the page
- this one from a different domain
If the includes for your script only says http://www.blah.com then it
will not apply to any of the frames
If the includes is http://www.blah.com* then it will apply to the main
page, the foo frame, and the goo frame - any page that starts
http://www.blah.com. It will not start on http://www.wingo.com
If the includes are http://www.blah.com* and http://www.wingo.com then
it will work on all three
If the top page and the frame URLs pass the @include test then your GM
script will run on all.
If you do any x.innerHTML = '...<iframe ...>...'
then that iframe's url will be (re)loaded and if it is @included then
your GM script will run.
If you want to make your GM script run differently on frames (like
maybe do nothing) you can check (window.top == window) to see if the
page loaded in a frame and what type, or if your script is causing the
frames then you can do something like <iframe src="foo.htm#myFrame">
and then have the script check for (document.location.hash ==
'#myFrame).
I've read on http://www.greasespot.net/2005/12/troubleshooting-064.html
that problem is the missing config.xml file. But when i get to my
Progiles\gg19waib.default
file gm_Scripts\config.xml exists...
I have Firefox 2.0.0.2 and gm 0.6.7
Thx