Aha!

The appending to the documentElement worked great. Having the HEAD null when
I tried that method out before caused me to default to that DOM loaded
listener. Great to know.

Thanks a bunch for that bit of dom info Aaron. Appreciate the reply.
Definitely enjoying extension dev :-)

Cheers.

2009/12/4 Aaron Boodman <[email protected]>

> It looks to me like you are purposely waiting until load to inject
> your script tag:
>
> On Thu, Dec 3, 2009 at 9:09 PM, brentlintner <[email protected]>
> wrote:
> > Our 'classes/insertion.js' looks like this:
> >
> >  window.addEventListener('load',function(e){
> >
> >                var head = document.head; //doc head
> >                var d; //temp var to hold element objects
> >
> >                //find the first script node
> >            d = document.createElement("script");
> >
> >            d.setAttribute("src", "<ourJSscriptGoesHere");
> >            d.setAttribute("type", "text/javascript");
> >
> >            head.appendChild(d);
> >  },true);
>
> If you remove the window.addEventListener part, it should run before
> any other script. Of course, there will be no HEAD element at that
> point, so you should append the script element to
> document.documentElement instead.
>
> - a
>



-- 
Brent

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to