Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Location pathname Property

Location pathname Property

Location Object Reference Location object


Definition and Usage

The pathname property is a readable and writable string that sets or returns the path part of the current URL.

Syntax

location.pathname


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the pathname property.


Example

Example

Return the pathname of the current URL:

The example above produces the following output:

Try it »


Location Object Reference Location object