Latest web development tutorials
 

Area pathname Property

< 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

Property
pathname Yes Yes Yes Yes Yes

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