Location pathname Property
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





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