HTML DOM Area hostname Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Area hostname Property

❮ Area Object

Example

Return the hostname of the URL for a specific area in an image-map:

var x = document.getElementById("venus").hostname;
Try it Yourself »

Definition and Usage

The hostname property sets or returns the hostname part of the href attribute value.

The href attribute specifies the destination of a link in an area.


Browser Support

Property
hostname Yes Yes Yes Yes Yes

Syntax

Return the hostname property:

areaObject.hostname

Set the hostname property:

areaObject.hostname = hostname

Value Description
hostname Specifies the hostname of a URL

Technical Details

Return Value: A String, representing the domain name (or IP address) of the URL

More Examples

Example

Change the hostname of a specific area in an image-map:

document.getElementById("venus").host = "www.example.com";
Try it Yourself »

Related Pages

JavaScript reference: location.hostname Property


❮ Area Object