| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The CustomEvent interface can be used to attach custom data to an event generated by an application.
As an alternative to CustomEvent, you can subclass the Event interface to add custom data and behavior.
Note:
If used to attempt to communicate between a web extension content script and a web page script, a non-string detail property throws with "Permission denied to access property" in Firefox. To avoid this issue clone the object. See Share objects with page scripts for more information.
CustomEvent()Creates a new CustomEvent.
This interface inherits properties from its parent, Event.
CustomEvent.detail Read onlyReturns any data passed when initializing the event.
This interface inherits methods from its parent, Event.
CustomEvent.initCustomEvent() Initializes a CustomEvent object. If the event has already been dispatched, this method does nothing.
| Specification |
|---|
| DOM # interface-customevent |
This page was last modified on Jul 29, 2025 by MDN contributors.
CustomEventAbortControllerAbortSignalAbstractRangeAttrCDATASectionCharacterDataCommentDOMErrorDOMExceptionDOMImplementationDOMParserDOMTokenListDocumentDocumentFragmentDocumentTypeElementEventEventTargetHTMLCollectionMutationObserverMutationRecordNamedNodeMapNodeNodeIteratorNodeListProcessingInstructionQuotaExceededErrorRangeShadowRootStaticRangeTextTreeWalkerXMLDocumentXPathEvaluatorXPathExpressionXPathResultXSLTProcessorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |