On an active website I go to, there is this javascript code that is displayed on every page.
<script type="text/javascript">
(function(){var d=document;var i=d.getElementsByTagName('iframe');if(google_ad_client!=null||(window.getComputedStyle?d.defaultView.getComputedStyle(i[i.length-1],null).getPropertyValue('display'):i[i.length-1].currentStyle['display'])=='none'){
alert('Adblock detected, please consider disabling it')
}})()
</script>
Is there any way that I could get my adblock — or any other type of plugin — to disable that specific code without disabling all javascript?
Best Answer
You can use the Greasemonkey add-on to rewrite the
alert
function:The way this works is as follows:
If the alert box's message matches "Adblock detected, please consider disabling it", then discard it to the JS console (it will not be displayed). Otherwise, display the alert box as a
confirm
box.