Area hostnameProperty
Area Object
Definition and Usage
The hostname property sets or returns the hostname part of the href property value.
Syntax
areaObject.hostname=hostname
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the hostname property
Example
Example
The following example returns the hostname of the "Venus" area in the image map:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>Hostname of the Venus area:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
</head>
<body>
<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>Hostname of the Venus area:
<script>
document.write(document.getElementById('venus').hostname);
</script>
</p>
</body>
</html>
The above example outputs:
Hostname of the Venus area: www.example.com
Try it Yourself »
Area Object Other Extensions