MDN self-hosted library · e01.org

Document: beforescriptexecute event

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
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;