Document.head

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

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

예제

html
<!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
HTML
# dom-document-head-dev

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
head

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

같이 보기