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 2018년 6월.
예제
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> |
브라우저 호환성
Loading…