Url.pathname (Property)

The pathname portion of an HREF URL if there is one.

Availability:

JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape version - 2.0
Opera browser - 3.0
Property/method value type:String primitive
JavaScript syntax:-myUrl.pathname
-myUrl.pathname = aPath
HTML syntax:<A HREF="..."> <LINK HREF="...">
Argument list:aPathA new pathname value

This property yields a text string that contains the pathname value from the URL if there is one and an empty string if not.

MSIE and Netscape support the use of this property as an LValue. If you write to it, the pathname portion of the HREF value is modified. Be careful not to include a hash or search/query value.

Example code:

   <HTML>

   <HEAD>

   </HEAD>

   <BODY>

   <A NAME="EXAMPLE" HREF="http://www.mydomain.com:8080/folder/file.html#abcdef">Click here</A><BR>

   <SCRIPT>

   document.write(document.links[0].pathname);

   </SCRIPT>

   </BODY>

   </HTML>

See also:Anchor.hash, Anchor.pathname, URL, Url object, Url.hash, Url.host, Url.hostname, Url.href, Url.port, Url.protocol, Url.search, Url.target