SyntaxFix
Write A Post
Hire A Developer
Questions
Use document.location object and its host or hostname properties.
document.location
host
hostname
alert(document.location.hostname); // alerts "stackoverflow.com"