Window location.pathname
描述
pathname 属性设置或返回 URL (页面) 的路径名。
语法
返回 pathname 属性
location.pathname
设置 pathname 属性
location.pathname = path
属性值
| 参数 | 描述 |
| path | URL 的路径名。 |
返回值
| 类型 | 描述 |
| 一个字符串 | 当前路径名。 |
浏览器支持
location.pathname 在所有浏览器中都支持
| Chrome | Edge | Firefox | Safari | Opera | IE |
| 是 | 是 | 是 | 是 | 是 | 是 |