Create an Account
username: password:
 
  MemeStreams Logo

Adblock detection

search

Acidus
Picture of Acidus
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Acidus's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
Adblock detection
Topic: Miscellaneous 11:23 pm EDT, May 13, 2009
if (document.images) {
  var currImg;
  var ImgFound = 0;
  var LinkFound = 0;
  //alert("checking images..");
  for (var d=0; d < document.images.length; ++d) {
    currImg = document.images[d];
    if (currImg.src.indexOf("banner") > -1) {
     ImgFound = 1;
    }
  }

  if (!ImgFound || AdBlockTest) {
     if(deny) {	 
       location = "/sorry.html";
       window.location(location);		
     } else {
	document.getElementById('warning').style.visibility = 'visible';
     }
  }

}

Interestingly simple. All the Adblock detection I've seen in the past checked CSS properties of elements surrounding an ad to see if the ad was rendered or not. This implementation requires a separate <img src> tag but I imagine this could be refactored into a (new Image()).src call and have a pure JavaScript solution.

Adblock detection



 
 
Powered By Industrial Memetics
RSS2.0