티스토리 뷰

Hide AdSense on Selected Pages Sample Code


<html>
<body>

<script type="text/javascript">
// hide AdSense on selected pages
// add this code right before the </body> tag
var targetURLs = new Array();
targetURLs[0] = "procoder.tistory.com/1$"; // use Regular Expressions
targetURLs[1] = "procoder.tistory.com/2$";
targetURLs[2] = "procoder.tistory.com/3$";
targetURLs[3] = "procoder.tistory.com/1[0-9]{2}$";
for (var i in targetURLs)
{
   var myRegExp = new RegExp(targetURLs[i], "i"); // ignore case
   if (document.URL.match(myRegExp))
   {
      var myElements = document.getElementsByTagName("iframe");
      for (var j in myElements)
      {
         if (myElements[j].src.match(/googlesyndication.com/i))
         {
            myElements[j].style.display = "none";
         }
      }
   }
}
</script>
</body>
</html>



'Code > JavaScript' 카테고리의 다른 글

[JavaScript] Redirecting URL  (0) 2009.05.09
[JavaScript] Redirecting URL  (0) 2009.05.09
[JavaScript] Redirecting URL  (0) 2009.03.05
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함