THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Area hostname Property

Area Object Reference Area Object

Example

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

var x = document.getElementById("venus").hostname;

The result of x will be:

www.w3schools.com
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

Internet Explorer Firefox Opera Google Chrome Safari

The hostname property is supported in all major browsers.


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 Reference Area Object