Location Object
The host property returns the hostname of a URL.
![]()
The hostname property is supported in all major browsers.
Return the hostname of the current URL:
The output of the code above will be:
Location Object
Your message has been sent to W3Schools.