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 »

Description

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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.