GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — CustomEvent - Web APIs | MDN

CustomEvent

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

  • See full compatibility
  • Learn more

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.

Constructor

CustomEvent()

Creates a new CustomEvent.

Instance properties

This interface inherits properties from its parent, Event.

CustomEvent.detail Read only

Returns any data passed when initializing the event.

Instance methods

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.

Specifications

Specification
DOM
# interface-customevent

Browser compatibility

See also

  • Window.postMessage()
  • Creating and dispatching events

Help improve MDN

Learn how to contribute

This page was last modified on Jul 29, 2025 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.