X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook