How To Detect AdBlock Plus

By Angsuman Chakraborty, Gaea News Network
Monday, November 12, 2007

AdBlock Plus is a controversial Firefox plugin to prevent ads from displaying on web pages. There is a simple procedure to detect (and take appropriate action) AdBlock Plus.

The idea is to dupe itself in thinking that a Javascript is from a well known advertising site like Google AdSense or Here is a code snippet that I found on AdBlock Plus forum that should give you the essential idea:

< script language=”javascript”>
var disabled = false;
< /script>
< script src=””></script>
< script language=”javascript”>
alert(”You Are Using Ad Block Plus or some other advert blocking software!\nAVForums relies on advertising for revenue. Please add AVForums to your ad blocking whitelist or disable ad blocking when you visit AVForums.\nFor more information, visit”);
< /script>

There are three issues with this code snippet:
1. It doesn’t specifically detect AdBlock Plus.
2. Dedicated users of your site may use regular expression to specifically exclude such url’s on your site.
3. AdBlock Plus may be modified in future to catch this pattern

You can use PHP / JSP to regularly change the URL pattern, switching between alternative URL’s. This will address most of the issues. I may even post an example if there is enough interest.


March 1, 2010: 8:00 am

This anti block for WP? it’s work in blogger to?

November 29, 2009: 7:10 pm

So I just disable javascript and it won’t work, which is the default way I load webpages. NoScript FTW

jamil makarem
October 19, 2009: 2:54 am

Please cancel my instructions of end september and cancel my adblock plus and all my instructions and i want that my email will be returned normal like before.thanks and sorry for any inconvenience caused

October 19, 2008: 7:39 pm

Thanks Dick. I have made the change. Stupid WordPress consumes left angular brackets which is not immediately followed by a space!

Dick Cheney
October 19, 2008: 3:27 am

Angsuman, great to see your progress with learning HTML and usage of SEO tools.

But, maybe you should quote the script tag in order to make your snippet show up :) It is currently only visible in the html source code.

December 12, 2007: 11:58 am

It was hidden. Now it is visible. Thanks for pointing it out.

December 12, 2007: 9:14 am

I don’t see the code snippet? Is it gone?

will not be displayed