Window location.pathname
描述
pathname
屬性設定或返回 URL (頁面) 的路徑名。
語法
返回 pathname 屬性
location.pathname
設定 pathname 屬性
location.pathname = path
屬性值
引數 | 描述 |
path | URL 的路徑名。 |
返回值
型別 | 描述 |
一個字串 | 當前路徑名。 |
瀏覽器支援
location.pathname
在所有瀏覽器中都支援
Chrome | Edge | Firefox | Safari | Opera | IE |
是 | 是 | 是 | 是 | 是 | 是 |