Tom Hubbard
Tom Hubbard

Reputation: 16119

Javascript way to disable other script tags from executing?

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

Answers (3)

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

dstarh
dstarh

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

wajiw
wajiw

Reputation: 12269

No, javascript can only manipulate parts of the DOM that are loaded already.

Upvotes: 4

Related Questions