Search code examples
javascripthtmladblock

Ad Blocker detection AKA Adblock Plus


After searching Google and Stackoverflow for a few hours I could not find a solution. What I'm trying to do is detect Adblock plus and display a simple message for now.

What I want to do is detect Adblock plus without using a JavaScript file or jQuery. Most of the adblock plus detect scripts they use a file, example "show_ads.js" that is hosted on there own domain with a line it in to set it "adblock = false;"

The problem with using a JavaScript file, users can white list that JavaScript file and it will no longer detect it. What I'm looking for is a JavaScript that loads directly into the HTML that would detect if someone is using ad blocker without the use of a file.

Example Below:

<script type="text/javascript">
 // line of code that detects if using ad blocker

 if so display message
 </script>

The reason behind doing it this way no ad blocker can white list the JavaScript file on your server. Yes I know there are other methods of getting around this with NoScript addons but I already have a solution for that. I have a great idea that has never been tried and ad blockers cannot block this once I get done with it.

Any suggestions and Examples will be greatly appreciated.


Solution

  • I have found one of the best scripts if you use third party ads.

    antiblock.org Disclaimer I'm not affiliated with this site in anyway.

    It will work for most sites and if they want to bypass it they will have to add their own filters (complicated for normal users) or contact adblock filters and have one added but they quit doing that cause the list is getting over loaded and slowing down ad block users.