THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Area host Property

Area Object Reference Area Object

Example

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

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

The result of x will be:

www.w3schools.com:80
Try it yourself »

Definition and Usage

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

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

Note: If the port number is not specified in the URL (or if it is the scheme's default port - like 80, or 443), some browsers will not display the port number.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The host property is supported in all major browsers.


Syntax

Return the host property:

areaObject.host

Set the host property:

areaObject.host=hostname:port

Value Description
hostname:port Specifies the hostname and port number of a URL

Technical Details

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

More Examples

Example

Change the hostname and port number of the URL for a specific area in an image-map:

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

Related Pages

JavaScript reference: location.host Property


Area Object Reference Area Object