MarkusWillson
MarkusWillson

Reputation: 421

How to detect adblock type

I have seen on this question that AdBlock can be detected with something such as

function blockAdblockUser() {
    if ($('.myTestAd').filter(':visible').length == 0) {
        // All are hidden, or "not visible", so:
        // Redirect, show dialog, do something...
    } else if ($('.myTestAd').filter(':hidden').length > 0) {
        // Maybe a different error if only some are hidden?
        // Redirect, show dialog, do something...
    }
}

But, is there any way to detect the type of AdBlock that this person is using?

Upvotes: 2

Views: 453

Answers (1)

Kevin
Kevin

Reputation: 30151

Not reliably. Ad blockers are not designed to be easy to detect and differentiate. Furthermore, code running on the client is fundamentally unsafe; a power user can and will subvert it if it bothers them, or if the person developing the ad blocker thinks it might hypothetically be used to bother someone.

You may be able to discern which list of patterns the user is blocking by varying the names of your ads (or using fake "ads" that the blocker might or might not block), but that information will age rapidly, since most such lists are updated frequently. Some of them whitelist fake ads for compatibility reasons.

Upvotes: 2

Related Questions