Location hostname property
Definition and Usage
hostname property is a readable and writable string sets or returns the current URL's hostname.
grammar
location.hostname
Browser Support
All major browsers support hostname property
Examples
Examples
Returns the host name of the current URL:
<script>
document.write(location.hostname);
</script>
document.write(location.hostname);
</script>
Examples of the above output:
try it"
Location Object