ranking Sort Sort   |   date Sort Sort   |   member Sort Sort

Date Submitted Wed. Nov. 19th, 2008 2:51 PM
Revision 1
Scripter Fordiman
Tags / | AdBlock | detect | Handy | little | script | to
Comments 0 comments
If your site is funded by advertisements, you may be annoyed with the growing use of AdBlock.

Well, a fair way to deal with AdBlock users is to degrade content (e.g., limit your archives, serve lower-bandwidth versions of images, prevent downloads, etc). The simple PHP script below will have your browser look for the presence of AdBlock/AdBlock+ and run a little Javascript of your choosing if AdBlock is present.

Just note: it's your choice on what to do about AdBlocking users. Blocking them outright will get you little more than a "Screw you"; degrading content may yield a similar response, but not so much if it's accompanied by a plea concerning your sole revenue source.

The PHP script fully randomizes variable names and randomizes the order of parallelizable tasks, and chaffs the file with whitespaces, and has a short list of false positives it can initiate. This is meant to reduce the potential for reverse detection (AdBlock blocking the AdBlock detector). It's also meant to be an inline script, for the same reason (you can't regex a filename that doesn't exist).

Example of use: