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