Area hostname attribute
Definition and usage
hostname
Attribute sets or returns href attribute value The hostname part.
href
Specifies the destination of the link in the defined area.
See also:
JavaScript Reference Manual:location.hostname attribute
Example
Example 1
Return the hostname of the URL of a specific area in the image map:
var x = document.getElementById("venus").hostname;
Example 2
Change the hostname of a specific area in the image map:
document.getElementById("venus").host = "www.example.com";
Syntax
Return the hostname attribute:
areaObject.hostname
Set the hostname attribute:
areaObject.hostname = hostname
Attribute Value
Value | Description |
---|---|
hostname | Specifies the hostname of the URL. |
Technical Details
Return Value: | A string value representing the domain name (or IP address) of the URL. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |