AdBlock Detection Script
Install this script on your site to notify and educate your users about the effects of AdBlock software by presenting them with a message on the page if and only if they have software on their computer that has prevented an image from loading properly. Follow the instructions below to install and test the Adblock Detection Script.
Note: this script has been designed to detect the specific behavior of blocking a graphic with the name “banner”, a characteristic of Norton’s security products. Other Adblocking software may not be detected.
Click here to see a demonstration of this script.
1. Download and install these two files in the root directory of your server:
adblock.js — Adblock Javascript code
banner.gif — AdBlock “bait” used to detect the presense of AdBlock software
2. Cut and paste the following code into the bottom or footer of your website:
<img src="/banner.gif" width=1 height=1>
<script language="Javascript">
// This script is provided by AdBlock.org, the full code must
// accompany the usage of this script.
// You may change the look and behavior as long
// as the link to AdBlock.org remains intact.
// Set the AdBlockTest variable to 1 to test.
// Don't forget to set it back to zero again before use.
var AdBlockTest = 0;
</script>
<script language="Javascript" src="/adblock.js"></script>
This site is supported by advertising.
Learn how AdBlock software
harms webmasters.
3. Test the script with actual AdBlocking software. If software is not available, uncomment the AdBlockTest variable. Note: This script only works on IE 5+, NN6+, Mozilla Firefox, and Opera 6+.
4. Sign up for notification of updates to this script.
WARRANTY
BECAUSE THE AdBlock.org AdBlock detection script (AbDS) IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE AbDS, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE AbDS “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK OF USE OF THE AbDS IS WITH YOU. SHOULD THE AbDS PROVE FAULTY OR OTHERWISE UNACCEPTABLE YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION.
July 28th, 2004 at 10:44 am
To download the two files, right click on each link and “save as”. On a Mac with a single-button mouse, Ctrl+click on each link.
September 1st, 2004 at 6:43 am
The script produces an error “AdBlock Test” is undefined. Can you fix the script - the .js file last few lines of code… Thanks
September 1st, 2004 at 6:48 am
if (!ImgFound || AdBlockTest) AdBlockTest is undefined is the javascript so it pops up an error message when people try to view your site if they haven’t check off disabled script debugging.
September 1st, 2004 at 7:13 am
Right, thanks for the bug report. Instead of commenting out AdBlockTest, setting it to zero for no test.
September 1st, 2004 at 8:27 am
Has anybody tried out this script?
September 7th, 2004 at 7:29 am
could someone who has more knowledge of JS make aver of this that would dissallow usere with blocked ads?? Please post code here, I will check back,
Thanks,
Jim Hysmith
September 7th, 2004 at 7:30 am
could someone who has more knowledge of JS make aver of this that would dissallow usere with blocked ads?? Please post code here, I will check back,
Thanks,
Jim Hysmith
September 7th, 2004 at 7:32 am
aver = a version. usere = users.
Thanks,
Jim Hysmith
September 7th, 2004 at 11:21 am
Jim, sure, it wouldn’t be too difficult. Instead of showing the message, you could always redirect them to a different page. My first version of this script worked like this, but I thought it too agressive to post here. I’ll put one together soon.
September 7th, 2004 at 11:37 am
I’ve updated the script, now version 1.2, which has an option (disabled by default) to deny access.
To turn on that option, set the deny variable to 1 in the adblock.js file. You will also need to create a page named /sorry.html which will be shown to the user.
September 9th, 2004 at 12:00 pm
Thanks for the update, however there appears to be a problem, making testing difficult. In my testing, the forwarding happens too fast. The forwarding happens so fast, there is no way go back one page to “clear the cookie” to retest and review the results. Adding a few second delay to the forwarding would allow for refresh.
Thanks,
Jim Hysmith
September 9th, 2004 at 12:05 pm
Also,
For other users, I “lifted” this little link from your site, it makes testing easier…
click
here to clear the cookie
…just past in your html for testing.
Thanks,
Jim Hysmith
October 5th, 2004 at 2:11 am
For some reason I can’t get this to work. I installed an adblocker and set it to specifically block “banner”.. nothing happens other than the banner disapears. (I’d set the banner to default size during testing to check)
Any ideas? It works if I set it to test, but it really should be blocking me without it when I’m using an adblocker :/
(I’m using adblock for firefox in case that makes a difference)
October 8th, 2004 at 9:20 pm
This method doesn’t work with Firefox’s adblock. This script looks to see if a page was modifed before being shown to the browser in such a way that the image tag has actually been removed.
The Adblock firefox plugin is integrated in the browser in such a way that it doesn’t modify the html, and the browser’s javascript still thinks that the image is there. It is still there, actually, the Firefox browser just doesn’t show it.
We feel that the Adblock software is a lesser evil. If it exists on a user’s sytem, it was installed deliberately. Further, the user must have added in their blocking rules. Consider that versus the Norton user who has this blocking installed without knowing it. The latter is what this script targets.
October 22nd, 2004 at 9:32 pm
There is one fairly major problem with your script as it is at the moment.
Your script is that you will catch many people who have ads visible (banners, skyscrapers, even popups), but who have made the sensible decision to block web-bugs/web-beacons.
March 23rd, 2005 at 4:02 pm
There’s far more than one major problem with this script Baz. If you could stop users from blocking anything but ad images it might be remotely useful, but all anybody has to do is block adblock.js itself and this thing is dead in the water.
March 25th, 2005 at 3:23 pm
You guys are missing the point. This is to get in front of the people who don’t know they have some adblocking solution turned on.
Of course a motivated individual who wants to block ads will be able to do that. The motivated individual isn’t a good ad target anyway.
April 22nd, 2005 at 3:53 pm
Funny - the site owner doesn’t use this script at the very page that promotes it. I block their images but receive no warning of such on this page.
May 17th, 2005 at 10:37 am
Someone asked for a more advanced script that blocks users who blocks ads. The website EnvironmentalChemistry.com uses a pretty comprehensive collection of JavaScript and CSS instructions to detect and block users who block their ads. It also appears to use some server side tricks as scripts use randomly generated function names, variables, etc. There even appear to be bait functions that are designed to trip up script rewriting programs like Proxo that try to anticipate and disable ad-blocking countermeasures.
Their script seems pretty well thought out and some creative individuals may be able to reverse engineer it to come up with something similar.
June 24th, 2005 at 3:08 pm
What about sites like www.Kaxy.com and www.Proxify.com that allow you to surf anonymously. Both sites and others like them, claim to remove ads. And how many sites really can use this if it’s just in js? I mean if that’s turned off, wouldn’t the counter-ad scripts be useless.
June 26th, 2005 at 10:38 pm
Well, reading some the responses by Adblock on this page makes his/her argument a little more rounded out.
Issues I’m reading about NIS here (caveat that I have never used NIS myself, norton sucks bad as far as sys resources go) that I would myself take offense to:
1. Blocking images based on size.
2. Dscriminating between advertising sites that should and shouldn’t be blocked.
Unfortunately Adblock’s efforts are ruined by the webmasters who don’t care and will continue the ad spamming that drives people nuts.
ol
June 29th, 2005 at 5:55 pm
> And how many sites really can use this if it’s
> just in js? I mean if that’s turned off, wouldn’t
> the counter-ad scripts be useless.
In regards to the EnvironmentalChemistry site.
There are multiple parts to the script. If you play with it for awhile and review the HTML source, the CSS files and the Javascript files you will realize that almost all of the variables, function names, object IDs and some class names are randomly generated via server side code.
The site is designed such that the content is hidden until a JavaScript runs to detect that ads were displayed and then turns the content on.
Much of the true content is baited to have ad like tendencies. This forces ad blocking software to block legitimate content and it trips up ad blocking software that is trying to disarm the countermeasures.
If ads were blocked, or hidden the user gets redirected to a banner blocking page that politely explains why the site doesn’t allow ad free access to the site unless the user pays a subscription fee. Having an ad free paid subscription option that is reasonably priced is really important as it eliminates the bogus excuse “well I’d pay for ad free access if it were provided.” I have found that the cheap ad-free option disarms a lot of dissent about the script because it does give users the ability to surf ad free as they like, which makes it hard to argue that ads are being forced upon them because they are given a choice in the matter.
There are enough layers of traps and things are randomized enough, that most ad blockers can not skirt around the script. The only way to get around the script is to turn off JavaScript and CSS, which destroys the layout of the site and makes the site much less usable. Most users will never go to the trouble of necessary to get past this script. If one didn’t care about accessibility by alternative browsers, one could make the script even more resilient than this script is.
What those who use ad blocking tend to do when hit by this script is to go elsewhere, which in the end serves the purpose of not wanting to waste bandwidth on users who block ads.
The real important thing about this script is that each person who implements the theories does so in slightly different ways. This way ad blocking software can’t implement a one size fits all solution to this tactic.
August 5th, 2005 at 9:39 am
Lets all join forces to block such adlock discovery utilities first !
=========================================
= Say NO to web ads ! Reclaim your web! =
= You have the right to block ads ! =
=============blockads@gmail.com=============
Post comments to :
blockads@gmail.com
Use firefox http://www.mozilla.org/support/firefox/adblock
October 14th, 2005 at 10:29 am
What users want is “No Annoying Ads Guaratee” pledge from the Webmaster. Also user should have a choice whether TextAd or BannarAd to see. Whether Text or Graphics, font/color/theme of the ad should match other content of your site.
The path http://environmentalchemistry.com/ (see above comment by Ken Barbalace) took will only going to make this fight more vigorous than any corporation from Adblock software companies. If ten people complain about ads at http://environmentalchemistry.com/ they are going make Adblocker more intelligent.
November 14th, 2005 at 5:02 am
This is an excellent piece of work and something that I have been looking for, for a long time. I have an affiliate site and have been frustrated by this problem for years. All my pages are blank when add blocking is used. Do you know how much hard work goes into making such a site only to see it destroyed and defaced? It makes me look like a fool!
Every page on my site is hand coded, no WYSIWYG at all; only to see it destroyed before viewing. Van Gogh would have fainted if someone did this to his work. The people who make this software and I have the same goal in mind, to make a living. Why should they have the right to destroy me in order to gain financially? Perhaps all affiliate sites including MSN Shopping should just close shop? Then no one would have a need add blocking software would they? Quite correct I have many times proudly gone off to show my work to people on their computer only to find that every one of them has ad blocking turned on and most of them don’t even know it. Not, only that I have to show them how to turn it of as most can’t do it.
November 18th, 2005 at 2:12 am
Hi;
Can I give you some Feed Back to improve?
I am an affiliate site and know first hand what can happen.
I also can assure you that the people selling these products are also not happy at all.
War is war and is something we all have to face.
We are working actively together as a team to try to solve this problem.
November 27th, 2005 at 7:26 am
Don’t steal my CPU time with ads, but thanks for the educational script. I’d tell you how I circumvented your JS, but I don’t want you to improve it
December 4th, 2005 at 1:17 pm
A note of interest; this script does not appear to work on a site that is using PHP for some reason?
December 12th, 2005 at 8:32 am
[quote]Don’t steal my CPU time with ads, but thanks for the educational script. I’d tell you how I circumvented your JS, but I don’t want you to improve it
[/quote]
As a publisher I will tell you don’t steal the CPU time of my server nor my bandwidth by trying to gain access to my website while blocking ads and refusing to pay for an ad-free subscription.
Producing and distributing content costs money. Ads and ad-free subscriptions are the best way to generate revenue to pay those costs. Without ad revenues that pay for writers, programmers, server space and bandwidth, many websites and much of the unique content many sites contain simply wouldn’t exist anywhere.
Just as users have the right to block ads, web publishers have the right to deny access to those individuals who refuse to “pay” for access to their content and accepting ads is one way of paying for access.
If a user doesn’t want ads and decides to block ads, they must accept the fact that they will not be allowed to utilize some sites and will simply have to find their information elsewhere. Trying to force free access to a site that requires the acceptance of ads or the purchase of an ad-free subscription is theft of service and is an indefensible act.
January 9th, 2006 at 11:55 am
[quote]As a publisher I will tell you don’t steal the CPU time of my server nor my bandwidth by trying to gain access to my website while blocking ads and refusing to pay for an ad-free subscription.[/quote]
Advertising is part of the cost of doing business.
On the web, the paradigm is to give something away free of charge. That free (and presumably useful) information is what drives people to your site. That content _is_ advertising. If you can’t afford the hosting fees and bandwidth, you don’t belong on the web.
If you want web surfers to buy a subscription for your content, that content had better be good, or it will become a well known fact that your content aspirates in a major way.
Ken Barbalace has a right to publish anything in any way he sees fit on his web site, but he does not have the right to control what a web surfer sees on his screen.
The web surfer has that right, and that’s why he uses JavaScript, Java, Flash, and ad blockers.
Ken go try to make a decent living elsewhere instead of forcing people to look at your ads or persuade them to buy enough subscriptions because you have content good enough to buy.
January 21st, 2006 at 1:33 pm
re: Ken’s scree
http://castlecops.com/p16829-ads_gone_begging_box_new_almost_fun_problem_JD.html#16829
This post sums up the adblocking issue nicely. I’ve bookmarked it to share on occasions such as this.
March 9th, 2006 at 7:04 am
[…] A few years ago, we published a simple adblock detection script. Our purpose for this was to catch the users who had Norton Internet Security installed and inform them that the software they have installed may be blocking content (both ads and non-ads) without their knowledge. A few years have passed, and it seems that NIS have resolved some of their issues with default behavior and invisible installation. […]
August 7th, 2008 at 12:01 pm
“If you can’t afford the hosting fees and bandwidth, you don’t belong on the web.”
^This for the win.
If you think relying on site ads is going to put groceries in your fridge it’s time you shut off the computer and go get a job.
September 2nd, 2008 at 12:00 pm
I use your script at http://www.anfree.com and it work perfect wit Firefox 3.0.1, Opera 95.2, IE8, and Safari 3.1 and if there is any update please send me email.
Thanks.