Reputation: 16119
Is there a way to use JavaScript to "remove" a script tag from the DOM BEFORE the script tag gets a chance to execute.
Upvotes: 2
Views: 1099
Reputation: 12146
You can do that in Opera with user JavaScript. Here's and example from my UserJS:
window.opera.addEventListener('BeforeScript',function (e)
{
// src filter
var patt1=/collapse|sibnet|upload|progress|krscat|anet|textarea/gi;
// text filter
var patt2=/saturn-plus|tracker_krs|krasland/gi;
if (e.element.src.match(patt1)!=null || e.element.text.match(patt2)!=null) e.element.parentNode.removeChild(e.element);
},false);
Upvotes: 1
Reputation: 5076
why can't you remove the tag serverside ? perhaps there is an outbound filter you could use with apache to remove the tags?
Upvotes: 0
Reputation: 12269
No, javascript can only manipulate parts of the DOM that are loaded already.
Upvotes: 4