URL.hostname

URL 인터페이스의 hostname 속성은 URL의 도메인 이름을 담은 USVString을 반환합니다.

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

구문

const domain = url.hostname
url.hostname = domain

USVString,

예제

const url = new URL('https://developer.mozilla.org/ko/docs/Web/API/URL/hostname');
console.log(url.hostname); // Logs: 'developer.mozilla.org'

명세

Specification Status Comment
URL
The definition of 'URL.hostname' 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
hostnameChrome Full support YesEdge Full support 13Firefox Full support 22IE ? Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 22Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

같이 보기

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