This page was translated from English by the community.Learn more and join the MDN Web Docs community.
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 2018년 6월.
scripts 는Document인터페이스의 속성으로 문서 중<script> 요소의 목록을 반환합니다. 반환되는 객체는 단일HTMLCollection 객체입니다.
In this article
값
HTMLCollection입니다. 이를 사용하여 목록의 모든 요소를 배열처럼 가져올 수 있습니다.
예제
다음은 페이지 내<script> 요소의 존재를 확인하는 예시입니다.
js
let scripts = document.scripts;if (scripts.length) { alert("This page has scripts!");}명세서
| Specification |
|---|
| HTML> # dom-document-scripts-dev> |