View Single Post
Old 12-13-2008, 06:24 AM  
Bama
Confirmed User
 
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
Nifty Script To Check For Google Ad Blocking

PHP Code:
<script type="text/javascript">

function 
check()
  {
  var 
giframe document.getElementsByTagName("iframe");
  var 
bod document.getElementsByTagName("body");
  var 
blocked=1;  

  for (var 
0giframe.lengthi++)
    {
    var 
name giframe[i].getAttribute("name");
    if(
name == "google_ads_frame" && giframe[i].style.display != 'none')
      {
      var 
blocked=0;
      }
    }
  if (
blocked) {
    
bod[0].innerHTML '<br>&nbsp;<br><p align="center"><font color="red" size="+6" style="font-size:5em"><strong>WARNING!</strong></font><br /><br /><font color="#ffffff" face="Arial"><b>An ad blocking software has been detected. <br /><br />This site is supported only by contextual ads, <br /><br />so we ask you to whitelist this site or disable the ad blocking software completely. <br /><br /> Thank you.<br /><br />When you are done, you may click <a href="">Continue</a></font></b></p>';
    }
  }

setTimeout('check()'2000);
</script>
</head> 
Bama is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote