Advertisement
Guest User

Untitled

a guest
Aug 11th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. if (document.domain.toLowerCase().indexOf("domainName") != -1)
  2.  
  3. if(window.location.href.match(/://(.[^/]+)/)[1].toLowerCase().indexOf("domainName") != -1)
  4.  
  5. if(window.location.hostname.toLowerCase().indexOf("domainName") != -1)
  6.  
  7. if(location.hostname == "mysite.com"){
  8.  
  9. }
  10.  
  11. if(location.hostname.match('mysite')){} // will return null if no match is found
  12.  
  13. function isEquals(myhost){
  14. var hostName = window.location.hostname.split('.');
  15. myhost = myhost.split(".");
  16. //handle stuff like site:.com or ..com
  17. for (var x in myhost)
  18. if (myhost[x] == "") myhost.splice(x,1);
  19.  
  20. //j is where to start comparing in the hostname of the url in question
  21. var j = hostName.length - myhost.length;
  22. for(var i in myhost)
  23. {
  24. //if j is undefined or doesn't equal the hostname to match return false
  25. if (!hostName[j] || hostName[j].toLowerCase() != host[i].toLowerCase())
  26. return false;
  27. j++;
  28. }
  29. return true;
  30. }
  31.  
  32. window.location.hostname == "stackoverflow.com"?
  33.  
  34. var domainParts = window.location.hostname.split(".");
  35. domainParts[domainParts.length - 2] == "stackoverflow"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement