Location hostname Property
Definition and Usage
The hostname property sets or returns the hostname of a URL.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| hostname | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the hostname property:
location.hostname
Set the hostname property:
location.hostname = hostname
Property Values
| Value | Type | Description |
|---|---|---|
| hostname | String | Specifies the hostname of the URL |
Technical Details
| Return Value: | A String, representing the domain name, or the IP address of a URL |
|---|
❮ Location Object

