code description

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasahmed996
    New Member
    • Jun 2008
    • 160

    code description

    hi to all
    very stupid question here. please some one tell me following code is for what purpose?
    and do I need to modify it a bit to make it work ?

    Code:
    <script type="text/javascript">
    var sLocation = document.referrer.toLocaleLowerCase();
    //Links to boost
    var rDomains = ["http://www.google.com","http://www.apple.com"];
    //Allowed domain referrer
    var aDomains = ["google.com","yahoo.com"];
    var valid = 0;
    
    //Valid referrer
    for (i=0;i<aDomains.length;i++) {
    //Check referrer
    if (sLocation.indexOf(aDomains[i], 0) > -1)
    {
    valid = 1;
    break;
    }
    }
    
    //Valid referrer
    if (valid == 1)
    {
    //Loop
    for (i=0;i<rDomains.length;i++) {
    //alert(rDomains[i]);
    invisibleWindow("mydiv" + i,rDomains[i]);
    }
    }
    
    function invisibleWindow(iframeID, url) {
    divel = document.createElement("div");
    divel.id = "div" + iframeID;
    divel.style.width = "5px";
    divel.style.height = "5px";
    divel.style.visibility = "hidden";
    
    //Add div
    document.body.appendChild(divel);
    
    domiframe = document.createElement("iframe");
    domiframe.id = iframeID;
    domiframe.src = url;
    domiframe.style.width = "5px";
    domiframe.style.height = "5px";
    domiframe.style.visibility = "hidden";
    
    var divid = document.getElementById("div" +
    
    iframeID);
    divid.appendChild(domiframe);
    }
    
    </script>
  • RamananKalirajan
    Contributor
    • Mar 2008
    • 608

    #2
    To explain about the code, there are 2 global variables. One holding the url of some websites and he second which of the domains to be hide. Using those arrays they are checking whether these websites comes under hiding criteria. If yes those sites are hidden in the page. Can you explain what are you looking for?

    Thanks and Regards
    Ramanan Kalirajan.

    Comment

    • waqasahmed996
      New Member
      • Jun 2008
      • 160

      #3
      Thanks Ramanan Kalirajan
      actually i read this code in a script. i want to know how this code is helpful for a site. what is the purpose of hidding sites in the page? is this any concern for unlimited free traffic. Thanks again for your kind reply

      Comment

      • RamananKalirajan
        Contributor
        • Mar 2008
        • 608

        #4
        I am not sure about that, why this code was made. May be to avoid adds or someother kind of stuff. Or the user can browse some url through iframe. The creator wanted to stop viewing some sites. I am not sure about it. I am just giving some clues.

        Thanks and Regards
        Ramanan Kalirajan

        Comment

        Working...