Area pathname attribute

Definition and usage

pathname Attribute sets or returns href attribute value The pathname part.

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

Note:In the following example:

  • IE 9 and earlier versions return "jsref/venus.html"
  • IE 10+, Firefox, Opera, Chrome and Safari return "/jsref/venus.html"

Example

Example 1

Return the URL path of the specific area in the image map:

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

Try it yourself

Example 2

Change the URL path of the specific area in the image map:

document.getElementById("venus").pathname = "somenewpathname";

Try it yourself

Syntax

Return pathname property:

areaObject.pathname

Set pathname property:

areaObject.pathname = path

Attribute value

Value Description
path Specifies the path name of the URL.

Technical details

Return value: String value, representing the path name of the URL.

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support