View our reviews on Hot Scripts You can now obtain our example scripts and/or vote for them at Hotscripts. To visit Hotscripts click here.




These days many folks are using ad blocker programs/plug-ins. I even often use one when editing my own content etc...so, there are good uses for them. None the less sometimes they might cause a problem so here is some code to help you detect the ad-blockers (and notify the end user).

There is no doubt, some ads are just bad for your computer - I have had ads crash my laptop and try to install spyware etc... So really, ad blockers are a necessary evil.

Why do I call them an 'evil'?

I call ad-blocker programs 'evil' because the seriously impact the webmasters of the sites you visit. many of us provide free services and spend much time helping folks out each day. We obtain no paycheck or salary except what we can obtain via advertising. When you stop our ads from being displayed you are helping to put us out of business.

In all fairness, most people have no idea just how bad these programs are to the sites they visit, so you cant really hold it against the folks. I have found that a simple notification might alert the visitor to the situation without being too obnoxious.

Below is some very simple Javascript that will detect if your Google ads have been blocked via some sort of ad blocker. The below code only detects blocked Adsense iframes but could possibly be modified to detect other ad units (or the lack thereof).


<script>
var detect_google_ads = document.getElementById('google_ads_frame1');
if(detect_google_ads == null){

//alert("Please disable your ad blocking software.");
//document.write("Please disable your ad blocking software.");
//location.replace("ad-blocker-notice.html");

}

</script>



More reading on this matter:
http://tropicalpcsolutions.blogspot.com/2010/03/using-ghostery-to-block-internet-ads.html

Bookmark / Share:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google


Do you have a thought about this article? Post a comment and tell us about it!