Area pathname Property

Area Object Reference Area Object

Example

Return the pathname of the URL for a specific area in an image-map:

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

The result of x could be:

/jsref/venus.htm

Try it yourself »


Definition and Usage

The pathname property sets or returns the pathname part of the href attribute value.

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

Note: In the example above, IE 9 and earlier versions returns "jsref/venus.htm", while IE 10+, Firefox, Opera, Chrome, and Safari returns "/jsref/venus.htm".


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The pathname property is supported in all major browsers.


Syntax

Return the pathname property:

areaObject.pathname

Set the pathname property:

areaObject.pathname=path

Property Values

Value Description
path Specifies the pathname of a URL

Technical Details

Return Value: A String, representing the pathname of the URL


More Examples

Example

Change the path name of the URL for a specific area in an image-map:

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

Try it yourself »


Area Object Reference Area Object

Color Picker

colorpicker