By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

code description

100+
P: 160
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 ?

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script type="text/javascript">
  3. var sLocation = document.referrer.toLocaleLowerCase();
  4. //Links to boost
  5. var rDomains = ["http://www.google.com","http://www.apple.com"];
  6. //Allowed domain referrer
  7. var aDomains = ["google.com","yahoo.com"];
  8. var valid = 0;
  9.  
  10. //Valid referrer
  11. for (i=0;i<aDomains.length;i++) {
  12. //Check referrer
  13. if (sLocation.indexOf(aDomains[i], 0) > -1)
  14. {
  15. valid = 1;
  16. break;
  17. }
  18. }
  19.  
  20. //Valid referrer
  21. if (valid == 1)
  22. {
  23. //Loop
  24. for (i=0;i<rDomains.length;i++) {
  25. //alert(rDomains[i]);
  26. invisibleWindow("mydiv" + i,rDomains[i]);
  27. }
  28. }
  29.  
  30. function invisibleWindow(iframeID, url) {
  31. divel = document.createElement("div");
  32. divel.id = "div" + iframeID;
  33. divel.style.width = "5px";
  34. divel.style.height = "5px";
  35. divel.style.visibility = "hidden";
  36.  
  37. //Add div
  38. document.body.appendChild(divel);
  39.  
  40. domiframe = document.createElement("iframe");
  41. domiframe.id = iframeID;
  42. domiframe.src = url;
  43. domiframe.style.width = "5px";
  44. domiframe.style.height = "5px";
  45. domiframe.style.visibility = "hidden";
  46.  
  47. var divid = document.getElementById("div" +
  48.  
  49. iframeID);
  50. divid.appendChild(domiframe);
  51. }
  52.  
  53. </script> 
  54.  
Feb 17 '10 #1
Share this Question
Share on Google+
3 Replies


RamananKalirajan
100+
P: 607
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.
Feb 18 '10 #2

100+
P: 160
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
Feb 18 '10 #3

RamananKalirajan
100+
P: 607
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
Feb 18 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.