[Greasemonkey] access to injected scripts?

Aaron Boodman zboogs at gmail.com
Mon May 30 10:31:25 EDT 2005


> (function() {
>         gm_content = document.documentElement.innerHTML;
>         alert(gm_content);
> })();
> 
> That's it, as simple as that.

Right. So within a user script, you will currently be able to see the
code for that script only. I think maybe you're seeing this and
thinking that you can similarly get the code for all scripts. You
cannot. As I showed in the previous code snippet, the script element
for each user script is removed from the DOM as soon as it is finished
being evaluated.

You should also not rely on being able to get the current script's
contents this way. The current method of injecting scripts is probably
not long for this world.


More information about the Greasemonkey mailing list