Document.scripts
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.
scripts
는 Document
인터페이스의 속성으로 문서 중<script>
요소의 목록을 반환합니다. 반환되는 객체는 단일 HTMLCollection
객체입니다.
값
HTMLCollection
입니다. 이를 사용하여 목록의 모든 요소를 배열처럼 가져올 수 있습니다.
예제
다음은 페이지 내 <script>
요소의 존재를 확인하는 예시입니다.
js
let scripts = document.scripts;
if (scripts.length) {
alert("This page has scripts!");
}
명세서
Specification |
---|
HTML # dom-document-scripts-dev |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scripts |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.