This is a snapshot of an early working draft and has therefore been superseded by the HTML standard.

This document will not be further updated.

HTML 5

Call For Comments — 27 October 2007

6.1. Event definitions

Messages in cross-document messaging and, by default, in server-sent DOM events, use the message event.

The following interface is defined for this event:

interface MessageEvent : Event {
  readonly attribute DOMString data;
  readonly attribute DOMString domain;
  readonly attribute DOMString uri;
  readonly attribute Window source;
  void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString domainArg, in DOMString uriArg, in Window sourceArg);
  void initMessageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString domainArg, in DOMString uriArg, in Window sourceArg);
};

The initMessageEvent() and initMessageEventNS() methods must initialise the event in a manner analogous to the similarly-named methods in the DOM3 Events interfaces. [DOM3EVENTS]

The data attribute represents the message being sent.

The domain attribute represents, in cross-document messaging, the domain of the document from which the message came.

The uri attribute represents, in cross-document messaging, the address of the document from which the message came.

The source attribute represents, in cross-document messaging, the Window from which the message came.