Window location.hostname attribute
- Previous Page host
- Next Page href
- Go to the Previous Level Window Location
Definition and usage
location.hostname
attribute to return the host of the URL (IP address or domain name).
You can also set location.hostname
Navigate to the same URL with a new hostname attribute.
See also:
Syntax
Return hostname attribute:
location.hostname
Set hostname attribute:
location.hostname = hostname
Attribute value
Value | Description |
---|---|
hostname | The hostname of the URL. |
Return value
Type | Description |
---|---|
String | The host of the URL (IP address or domain name). |
Browser Support
All Browsers Support location.hostname
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous Page host
- Next Page href
- Go to the Previous Level Window Location