alert blocker issues

in Script development
Subscribe to alert blocker issues 3 posts, 3 voices



jrim Scriptwright
FirefoxWindows

i have been having rouble getting alert blocker scripts to work with the newer version of firefox. this is the one i am currently using. it doesn't work. i still get alerts.

been like this since version 11.0. now on 13.0. is there a setting i should change? do you know why this doesn't work? i saw something called userprefs. but not sure how to change that

// ==UserScript==
// @name Alert blocker
// @version 0.0.1
// @author Fredrik
// @description Remove annoying javascript alerts
// @include *
// ==/UserScript==

var alert_script = document.createElement("script");
alert_script.setAttribute("type", "text/javascript");
alert_script.innerHTML = "function alert(m) {}";
document.body.appendChild(alert_script);

 
mike cupcake Scriptwright
FirefoxWindows

Would adding: @run-at document-start
to the metadata make a difference? Although that might cause the appendChild to fail, I'm not sure.

 
Jefferson Scher Scriptwright
FirefoxWindows

Could you change this:

alert_script.innerHTML = "function alert(m) {}";

to this:

myScriptContent = "function alert(m) {}";
alert_script.appendChild(document.createTextNode(myScriptContent));