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
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
head | Chrome Full support 4 | Edge Full support 12 | Firefox Full support 4 | IE Full support 9 | Opera Full support 11 | Safari Full support 5 | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown