定义和用法
主机名属性设置或返回URL的主机名。
浏览器支持
属性 | |||||
---|---|---|---|---|---|
hostname | 是 | 是 | 是 | 是 | 是 |
句法
返回的主机名属性:
location.hostname
设置主机属性:
location.hostname= hostname
属性值
Value | Type | Description |
---|---|---|
hostname | String | Specifies the hostname of the URL |
技术细节
返回值: | 一个字符串,代表域名或网址的IP地址 |
---|

主机名属性设置或返回URL的主机名。
属性 | |||||
---|---|---|---|---|---|
hostname | 是 | 是 | 是 | 是 | 是 |
返回的主机名属性:
location.hostname
设置主机属性:
location.hostname= hostname
Value | Type | Description |
---|---|---|
hostname | String | Specifies the hostname of the URL |
返回值: | 一个字符串,代表域名或网址的IP地址 |
---|