HackingUniversity - Hacks . Tricks . How-To's

15 September 2013

Display Warning Message if Adblock Extension is Installed

Adblock is an extension for chrome that usually blocks all the advertisements running on any website to give you some increase in your speeds but obviously many websites among me use advertisements to support our network and continuously work on it providing you with useful contents. Well but many people using Adblock extension simply bypasses the ads and we are left with lower revenue, well to overcome this problem Antiblock.org came up with a script that will show a warning message to disable the adblock to access your website.

adblock-disabling-script

So using this script one will see a warning message like above in the image and will not be able to view your websites content unless he disables his adblock extension. So now if you really think that your content is simply unique and should be rewarded than you can use this script and block people adblock people from watching your content.

Disable Adblock Extension for Blogger

Well below are the mentioned steps you can take in order to install the script on your blogger blog, well this script can be installed on any other blog too steps might be same but I am just going to explain only for the Blogger Blogs.

  1. Visit Blogger > Template > Edit HTML.
  2. Press Ctrl + F and search for ]]></b:skin> & paste below code above it.

    #g207{z-index:999999;position:fixed!important;position:absolute;top:0;top:expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+"px");left:0;width:100%;height:100%;background-color:#fff;opacity:0.9;filter:alpha(opacity=90);display:block}#g207 p{opacity:1;filter:none;font:bold 16px Verdana,Arial,sans-serif;text-align:center;margin:20% 0}#g207 p a,#g207 p i{font-size:12px}#g207 ~ *{display:none}

  3. Now press Save Template.
  4. Now navigate to Blogger > Layout > Add Gadget, Click on HTML/JavaScript Gadget.
  5. Paste the below code into it and press Save.

    <script>(function(w,u){var d=w.document,z=typeof u;function g207(){function c(c,i){var e=d.createElement('i'),b=d.body,s=b.style,l=b.childNodes.length;if(typeof i!=z){e.setAttribute('id',i);s.margin=s.padding=0;s.height='100%';l=Math.floor(Math.random()*l)+1}e.innerHTML=c;b.insertBefore(e,b.childNodes[l-1])}function g(i,t){return !t?d.getElementById(i):d.getElementsByTagName(t)};function f(v){if(!g('g207')){c('<p>Please disable your ad blocker!<br/>This site is supported by the advertisement <br/> Please disable your ad blocker to support us!!! </p>','g207')}};(function(){var a=['Adrectangle','PageLeaderAd','ad-column','advertising2','divAdBox','mochila-column-right-ad-300x250-1','searchAdSenseBox','ad','ads','adsense'],l=a.length,i,s='',e;for(i=0;i<l;i++){if(!g(a[i])){s+='<a id="'+a[i]+'"></a>'}}c(s);l=a.length;for(i=0;i<l;i++){e=g(a[i]);if(e.offsetParent==null||(w.getComputedStyle?d.defaultView.getComputedStyle(e,null).getPropertyValue('display'):e.currentStyle.display)=='none'){return f('#'+a[i])}}}());(function(){var t=g(0,'img'),a=['/adaffiliate_','/adops/ad','/adsales/ad','/adsby.','/adtest.','/ajax/ads/ad','/controller/ads/ad','/pageads/ad','/weather/ads/ad','-728x90-'],i;if(typeof t[0]!=z&&typeof t[0].src!=z){i=new Image();i.onload=function(){this.onload=z;this.onerror=function(){f(this.src)};this.src=t[0].src+'#'+a.join('')};i.src=t[0].src}}());(function(){var o={'http://pagead2.googlesyndication.com/pagead/show_ads.js':'google_ad_client','http://js.adscale.de/getads.js':'adscale_slot_id','http://get.mirando.de/mirando.js':'adPlaceId'},S=g(0,'script'),l=S.length-1,n,r,i,v,s;d.write=null;for(i=l;i>=0;--i){s=S[i];if(typeof o[s.src]!=z){n=d.createElement('script');n.type='text/javascript';n.src=s.src;v=o[s.src];w[v]=u;r=S[0];n.onload=n.onreadystatechange=function(){if(typeof w[v]==z&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){n.onload=n.onreadystatechange=null;r.parentNode.removeChild(n);w[v]=null}};r.parentNode.insertBefore(n,r);setTimeout(function(){if(w[v]!==null){f(n.src)}},2000);break}}}())}if(d.addEventListener){w.addEventListener('load',g207,false)}else{w.attachEvent('onload',g207)}})(window);</script>

  6. Now your CSS and JavaScript is pasted down, now just refresh your blog with Adblock Extension on and see the warning message appear.
  7. Now as soon as you disable the Adblock extension you will not see any warning message.

So that’s it now just give it a try and I hope you will be able to recover some of your blocked revenue using this easy script thanks to Antiblock.org for this script.