detect adblock on your site
at 2020-04-24 05:45:00.
since adblock is becoming popular you may not have the same revenue from advertisements as before on your site.
you can add the following code where the adversisement is usually on your website to ask the users to turn off the adblock
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
document.write("<h1>TURN OFF ADBLOCK!</h1>");
}
or make the content on your site unavaible to people with adblock turned on.
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
document.getElementById("wrapper").style.display = "none";
document.write("<h1>TURN OFF ADBLOCK!</h1>");
}