[Greasemonkey] access to injected scripts?
Jeremy Dunck
jdunck at gmail.com
Sun May 29 00:44:21 EDT 2005
On 5/28/05, Bill Donnelly <donnelly at snowcrest.net> wrote:
> So, even though you strip out the <script> tags, the scripts are
> still there, right? Because the code is still around to call, such
> as at onLoad, or a setTimeout() call, right?
> Are they "hidden" to such a degree that other scripts can't see them
> or find them? Can they be found when in XUL mode scripting?
> Inquiring minds want to know.
The javascript is evaluated and stays in the page context, even though
the script elms are removed.
So, you can't detect the scripts by looking at the DOM, but if you
know what functions those scripts export (if any) then you're set.
<gm script>
window.foo = function() {
alert('bah!');
}
</gm script>
later, you can say:
if(foo) {
//then that particular script was injected.
}
So maybe the short answer is "no", because lots of scripts could export foo...
More information about the Greasemonkey
mailing list