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.
location.host = hostname:port
It is used to set the host property.
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
- Apple Safari
- Internet Explorer
This article is attributed to GeeksforGeeks.org