Window location.pathname
Description
The pathname
property sets or returns the pathname of a URL (page).
Syntax
Return the pathname property:
location.pathname
Set the pathname property:
location.pathname = path
Property Values
Parameter | Description |
path | The pathname of the URL. |
Return Value
Type | Description |
A string | The current pathname. |
Browser Support
location.pathname
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |