Location host Property
Location object
Definition and Usage
The host property is a readable and writable string that sets or returns the hostname and port number of the current URL.
Syntax
location.host
Browser support





All major browsers support the host property.
Example
Example
Return the hostname and port of the current URL:
Output result of the above example:
Try it »
Location object