Detect Adblock in user’s browser and show message

Asked

Viewed 306 times

3

Is there any way, can be via JS, that detects that the user is using Adblock and send some message to the same?

1 answer

3


There are several ways to try to verify the use of Adblock, here are some:

$(document).ready(function(){
    DetectarAdBlockUser();
});

function DetectarAdBlockUser() {
if ($('.ClassDosSeusAds').filter(':visible').length == 0) {
    $('divAvisoAdBlock').show();
} else if ($('.ClassDosSeusAds').filter(':hidden').length > 0) {
    //colocar o que quer fazer caso alguns estejam hidden
} else if ($('.ClassDosSeusAds').height() == 0) {
    //colocar o que quer fazer
}

In the case is verified the existence of the attribute Hidden, height equal to zero and if it is not Visible.

Note that each Adblock varies in its execution form and new updates can lead to ways to avoid this type of detection

Browser other questions tagged

You are not signed in. Login or sign up in order to post.