MDN self-hosted library · e01.org

Document: afterscriptexecute event

DOM

DOM

The afterscriptexecute event fires when a static script element finishes executing its script. It does not fire if the element is added dynamically, such as with appendChild().

Syntax

Use the event name in addEventListener():

addEventListener("afterscriptexecute", (event) => { })

Alternatively, assign to the event handler property of the interface:

onafterscriptexecute = (event) => { }

Event type

A generic Event.

Examples

function finished(e) {
  logMessage(`Finished script with ID: ${e.target.id}`);
}

document.addEventListener("afterscriptexecute", finished);
// Or (but note that this replaces other event listeners
// added using onafterscriptexecute, if any)
document.onafterscriptexecute = finished;

View Live Example

Specifications

Not part of any specification.

Browser compatibility

See also

  • beforescriptexecute event of Document
  • Document.currentScript