if (document.domain.toLowerCase().indexOf("domainName") != -1)
if(window.location.href.match(/://(.[^/]+)/)[1].toLowerCase().indexOf("domainName") != -1)
if(window.location.hostname.toLowerCase().indexOf("domainName") != -1)
if(location.hostname == "mysite.com"){
}
if(location.hostname.match('mysite')){} // will return null if no match is found
function isEquals(myhost){
var hostName = window.location.hostname.split('.');
myhost = myhost.split(".");
//handle stuff like site:.com or ..com
for (var x in myhost)
if (myhost[x] == "") myhost.splice(x,1);
//j is where to start comparing in the hostname of the url in question
var j = hostName.length - myhost.length;
for(var i in myhost)
{
//if j is undefined or doesn't equal the hostname to match return false
if (!hostName[j] || hostName[j].toLowerCase() != host[i].toLowerCase())
return false;
j++;
}
return true;
}
window.location.hostname == "stackoverflow.com"?
var domainParts = window.location.hostname.split(".");
domainParts[domainParts.length - 2] == "stackoverflow"