FaltuTech.Club : Fane of Advanced Logical Thriving Utopian Technical Club

Simplest Way to Detect if Adblocker is Turned On

You can use below javascript code to detect if adblocker is turned on 


var newImg = new Image();
newImg.src = "https://1.bp.blogspot.com/-AA25pykjU0w/WT0oG85MmOI/AAAAAAAAHHw/I628lgK1QYAJdDRLprIIsCRVt5L0n7XagCLcB/s1600/ad.jpg";
newImg.onerror= function(){
	var classe=document.getElementById('block');
	classe.innerHTML="          Please Disable Your Adblocker               ";
}

What We are doing is : We are creating a image object (newImg) and loading an image which have name 'ad'. Which will be blocked by the adblocker. Then checking if there is any error in loading the image(newImag.onerror). If there is an error then we are displaying the error message in the HTML tag with id 'block'. You can customize the message as per your needs. Working in latest browsers but didn't tested in old browsers.