Java-Script to Detect Adblock in Browser

Introduction :

We know that almost 11 millions people in the world where using Adblock in their browser . Because of that almost every webmasters where loosing their online income day by day . Without showing ads on sites and blogs every free service become payable and some of them may be closed . Some of the famous sites like Youtube , Facebook , Etc need high amount of earnings from their free service to maintain their Servers and Staffs . 

About The Detect Code:

The Detect code allow you to show a message instead of your Adsense Ads or the other publisher ads which you placed in the website . The message will only show when any Adblock user visited your site . When any normal user visit your site , The message will not show , Instead of the message . The Adsense ads will show . Instead of the message you can also show Facebook Like Box or any other thing which you would like to place .

How to Detect Adblock :

It is very easy to detect Adblock on browser and show a message instead of your Ad-place . To do this you want to copy the below code and paste where ever you want to show the message . 
  window.onload = function(){ 
    setTimeout(function() { 
      var ad = document.querySelector("ins.adsbygoogle");
      if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) { = 'display:block !important'; 
        ad.innerHTML = 'Your custom HTML messages goes here';
        }, 2000); 
Replace the "Your custom HTML messages goes here" With the Html Message or other thing whch you want to show instead of the Adsense ads or the other Publisher Ads .

Suggested Article For Webmasters :

I hope you well enjoyed this article , If you have any doubts or suggestions related to this article , please let us know by using the comment box given below . Thanks