定義和用法
主機名屬性設置或返回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地址 |
---|