Skip to content

Instantly share code, notes, and snippets.

@sdiama
Created May 19, 2020 10:05
Show Gist options
  • Save sdiama/ff0b982252e2b54f88ca4107851df848 to your computer and use it in GitHub Desktop.
Save sdiama/ff0b982252e2b54f88ca4107851df848 to your computer and use it in GitHub Desktop.
Check if Adblock is present - Simple and Effective
<div class="adsbygoogle mycontent">This is my content</div>
<script>
setTimeout( function() {
if ( $('.mycontent').length > 0 ) {
if ( $('.mycontent').is(":hidden") || ! $(".mycontent").length ) {
alert('AdBlock Detected');
}
}
}, 1000);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment