Document: beforescriptexecute event
DOM
DOM
The beforescriptexecute event fires when a static script is about to start executing. It does not fire if the element is added dynamically, such as with appendChild().
Syntax
Use the event name in addEventListener():
addEventListener("beforescriptexecute", (event) => { })
Alternatively, assign to the event handler property of the interface:
onbeforescriptexecute = (event) => { }
Event type
A generic Event.
Examples
function starting(e) {
logMessage(`Starting script with ID: ${e.target.id}`);
}
document.addEventListener("beforescriptexecute", starting);
// Or (but note that this replaces other event listeners
// added using onbeforescriptexecute, if any)
document.onbeforescriptexecute = starting;
Specifications
Not part of any specification.
Browser compatibility
See also
- afterscriptexecute event of
Document - Document.currentScript