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
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