URL.pathname

URL 인터페이스의 pathname 속성은 URL의 경로와 그 앞의 /로 이루어진 USVString을 반환합니다. 경로가 없는 경우 빈 문자열을 반환합니다.

주의: 이 기능은 Web Worker에서 사용할 수 있습니다.

구문

const path = url.pathname
url.pathname = newPath

USVString.

예제

var url = new URL('https://developer.mozilla.org/ko/docs/Web/API/URL/pathname?q=value');
var result = url.pathname; // Returns:"/ko/docs/Web/API/URL/pathname"

명세

Specification Status Comment
URL
The definition of 'URL.pathname' in that specification.
Living Standard Initial definition.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
pathnameChrome Full support YesEdge Full support 13Firefox Full support 53
Full support 53
No support 22 — 53
Notes
Notes pathname and search returned the wrong values so that for a URL of http://z.com/x?a=true&b=false, pathname would return "/x?a=true&b=false" and search would return "", rather than "/x" and "?a=true&b=false" respectively.
IE ? Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 53
Full support 53
No support 22 — 53
Notes
Notes pathname and search returned the wrong values so that for a URL of http://z.com/x?a=true&b=false, pathname would return "/x?a=true&b=false" and search would return "", rather than "/x" and "?a=true&b=false" respectively.
Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

같이 보기

  • 속성이 속한 URL 인터페이스.