Document: currentScript property - Web APIs | MDN
Value
A HTMLScriptElement or null.
Examples
This example checks to see if the script is being executed asynchronously:
js
if (document.currentScript.async) {
console.log("Executing asynchronously");
} else {
console.log("Executing synchronously");
}
Specifications
| Specification |
|---|
| HTML # dom-document-currentscript-dev |
Browser compatibility
See also
import.meta<script>afterscriptexecuteevent ofDocumentbeforescriptexecuteevent ofDocument