I'm so tired of slow ads
Tuesday, 10. June 2008, 19:44:38
Many ads are added by just linking an external script to the page. I'm going to show you how to stop all scripts that are not originating from the domain you are currently visiting.
Copy the code below, save it to a file 'prevent_all_external_scripts.js' and add it to a folder. I call my folder 'userjs' and is placed in my documents.
window.opera.rx295723629 = new RegExp('^http:\/\/([a-zA-Z0-9\u0080-\u00ff-.]*)?'+location.hostname);
window.opera.addEventListener(
'BeforeExternalScript',
function (e) {
var src = e.element.getAttribute('src');
if(src.match(/^http:\/\//) && !src.match(window.opera.rx295723629)){
opera.postError('Script outside '+location.hostname+' was found and blocked: '+src);
e.preventDefault();
}
},
false
);
Open Tools->Preferences->Content->Javascript Options and add the folder to the text box at the bottom, where it says "User Javascript Files".
Now any site you are visiting will load scripts originating from the current domain, but ignore external scripts.












