[Greasemonkey] How to specify script injection time

Bill Donnelly donnelly at snowcrest.net
Sat Jul 16 00:06:56 EDT 2005


 From what little I can tell, there is no way,
and will probably not be any way, to inject earlier
until, and unless, a "special" event call is added
to the mozilla code. Right now, there is no event
that is called after actual DOM load and before
the mozilla-injected scripts are injected.

So, unless there is some way to get around the
problem in some other way, it ain't gonna happen.

And even then, you would need some way to make it
not load its scripts, that is, wait, until after Gm
has loaded her scripts.
(yes, Gm is female, like a sailing ship, if I may)

It _will_ signal a 'script error event', so, if there
was some way to make it inject a small script as
the first script with a 'known error' in it, and then
use that as a flag, and get it to inject the Gm scripts
"inbetween" that and the rest of the "HTML scripts",
then that might work. But that is probably a long shot,
if it would even work at all.

Other than that, you would have to peform some sort of
a timer-based check to see if the DOM has been completely
loaded, but even that may not work, because you would
have to "hijack" the system and gain control of it in
some way so that it wouldn't continue with injecting
its scripts until Gm had injected all of her scripts,
which I would think would not be possible considering
that it is written in C++ and Gm is XUL/JS.

So what we have is probably the best we'll ever get.
Unless you can convince the Firefox team to add in some
special code, but I would bet the odds of that are
somewhere between slim and none.

-- 
Jack the Ripper may have been quite insane,
but he had beautiful penmanship.
btw -- Don't look back!
The lemmings are gaining on you.



More information about the Greasemonkey mailing list