[Greasemonkey] access to injected scripts?

Bill Donnelly donnelly at snowcrest.net
Fri May 27 20:08:16 EDT 2005


I'm confused about the comments in this previous comment.
(below) Specifically this line:

   gm_content = document.documentElement.innerHTML;

When I execute that, I don't get the injected scripts, so
I was wondering what's going on. afaik, there is no way
to get to the injected scripts from outside Gm. We were
discussing this on another thread, and I lost track of it.

Anyway, anyone have any clarifications?

(I was also wondering about Jeremy's comment about
"The script tags added by GM are immediately removed."
and what that means and how it is done and why and what
that means regards accessing them "after the fact" ---
such as, let's say, wanting to write a GmScript that lists
all of the loaded GmScripts for a page, and/or maybe
displays their source)

 > On 5/25/05, Jeremy Dunck <jdunck at gmail.com> wrote:
 >
 > >> The script tags added by GM are immediately removed.  You shouldn't
 > >> see them, unless you're handling a mutation event on their injection.
 >
 > I'm doing something like this:
 >
 >    gm_content = document.documentElement.innerHTML;
 >
 > Now gm_content has the document *and* all the various GM scripts. So,
 > basically what I need is the content of the page after all GM scripts
 > have done their cool jobs, but *without* the scripts themselves.
 >
 > Like Mark said, I could probably use DOMParser to play around, but
 > then that's not going to be a perfect solution, would it? Prolly
 > there's some easier way?
 >
 > -- Premshree Pillai http://www.livejournal.com/users/premshree/



More information about the Greasemonkey mailing list