HTML | DOM Location host Property
The Location Host property in HTML is used to sets or returns the hostname and port of a URL. The Location Hash property doesn’t return the port number if it is not specified in the URL.
- It returns the host property.
- It is used to set the host property.
location.host = hostname:port
hostname:port : It contains a string value which defines the hostname and portnumber of a URL.
Return Value: A String, representing the domain name and port number, or the IP address of a URL
Below program illustrates the Location host Property in HTML:
After click on the button:
Supported Browsers: The browser supported by Location host Property are listed below:
- Google Chrome
- Internet Explorer