After searching Google and Stackoverflow for a few hours I could not find a solution. What I\'m trying to do is detect Adblock plus and display a simple message for now.
The Smartest and easiest way I found is:
1) add this html
code on somewhere in your markup probably on top.
.
Usually ad blockers detect ad sizes of (pub_300x250) as mentioned in Easylist and blocked them, which is triggered by "bait".
2) then add this js code into your script file.
if (document.getElementById("bait").offsetHeight === 0) {
// function code or alert (whatever) here.
alert("Ad-Blocker DETECTED");
}
Our Script detects if that piece of markup is existed in present html
by checking thorugh "bait" id.
This works for me with Adblock
, AdBlock-Plus
& uBlock Origin
on every site on every browser.