WebTemp.org

Ad script

Maybe some of you wonder how these sites know that you are using AdBlock, WebWasher or another tool to filter ads. In these cases (if the AdSense banners are being blocked) you can see the PayPal button in the upper part.
A simple JavaScript sets up a trap for the ad filtering software. In case filtering is active the script replaces the original ad code (which is not functional anyway) by some alternative HTML code which could even contain another (locally hosted) banner.
Please use the code only for displaying text and/or images and not for blocking AdBlock users from your site completely (which I'd consider to be very lame by the way). And link WebTemp.org :)

The script offers a lot of advantages:

The DIV container

<div id="a">
<script type="text/javascript">
AdSense code goes here
</script>
<noscript>
Message displayed when JavaScript is disabled
</noscript>
</div>
The actual ad element has to be placed inside a DIV container.
Browsers without JavaScript or which have it deactivated won't display AdSense elements anyway. So this is also the right place for a <noscript> tag to display alternative stuff.

The JavaScript

<script type="text/javascript"><!--
var trap_active = true;
//--></script>
<script type="text/javascript" src="adsense.js"></script>
<script type="text/javascript"><!--
if (trap_active) {
  var s = "Message displayed when ads are being blocked";
  document.getElementById("a").innerHTML = s;
}
//--></script>
This script should be the very last thing right before the closing </body> tag to leave the visitor's web browser enough time for loading and displaying the ads. For the same reason there's a one second time delay before the script gets to check for blocked ads.
If you are using multiple DIV containers on your site, it is imperative to name them uniquely. However, it is sufficient to have the script check only the first one.

The file adsense.js (just one line)

trap_active = false;
The file name is crucial and tricks adblockers into seeing the file as a real adscript. If doesn't work (any more) you may experiment with other names (e.g. "adclick.js" or "adcode.js"). The filter list itself should provide you with enough ideas. Write me about your experiences!
United States 14:02:38 up 1 day, 12:38, 0 users, load average: 6.07, 6.66, 6.90 Contact • Legal info • Privacy policy