[adsense] How to detect Adblock on my website?

I have implemented many methods to detect adblock in the browser and all solutions failed except below one in javascript:

window.onload = function() {
    setTimeout(function() {
        var ad = document.querySelector("ins.adsbygoogle");
        if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
            console.log('You seem to blocking Google AdSense ads in your browser.');
        }
    }, 2000);
};

I hope this javascript solution will help you. Thanks for asking this question.

Examples related to adsense

How to detect Adblock on my website?

Examples related to adblock

How to detect Adblock on my website?