Document.head

Document 인터페이스의 head 읽기 전용 속성은 현재 문서의 <head> 요소를 나타냅니다.

예제

<!doctype html>
<head id="my-document-head">
  <title>Example: using document.head</title>
</head>

<script>
  let theHead = document.head;

  console.log(theHead.id); // "my-document-head";
  console.log(theHead === document.querySelector("head")); // true
</script>

참고

Document.head는 읽기 전용입니다. 값을 할당하려고 시도하면 조용히 실패하거나, 엄격 모드에서는 TypeError가 발생합니다.

명세

Specification Status Comment
HTML Living Standard
The definition of 'Document.head' in that specification.
Living Standard Initial definition.
HTML 5.1
The definition of 'Document.head' in that specification.
Recommendation  
HTML5
The definition of 'Document.head' in that specification.
Recommendation  

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
headChrome Full support 4Edge Full support 12Firefox Full support 4IE Full support 9Opera Full support 11Safari Full support 5WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

같이 보기