Area host attribute
Definition and usage
host
Attribute set or returned href attribute value The hostname and port part.
href
The attribute specifies the destination of the link in the area.
Note:If the port is not specified in the URL (or if it is the default port of the protocol - for example, 80 or 443), some browsers will not display the port.
See also:
JavaScript Reference Manual:location.host attribute
Example
Example 1
Return the hostname and port of the URL for a specific area in the image map:
var x = document.getElementById("venus").host;
Example 2
Change the hostname and port of the URL for a specific area in the image map:
document.getElementById("venus").host = "www.example.com:300";
Syntax
Return the host attribute:
areaObject.host
Set the host attribute:
areaObject.host = hostname:port
Attribute Value
Value | Description |
---|---|
hostname:port | Specifies the hostname and port number of the URL. |
Technical Details
Return Value: | A string value representing the domain name (or IP address) and port number of the URL. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |