Packagedom.events
Classpublic class MessageEvent
InheritanceMessageEvent Inheritance Event Inheritance Object

Introduced in: DOM 3 Events 

Messages in server-sent events, Web sockets, cross-document messaging, and channel messaging use the message event.

See also

HTML 5: MessageEvent


Public Properties
 PropertyDefined By
 InheritedDOM 2 Events bubbles : Boolean
[read-only] Used to indicate whether or not an event is a bubbling event.
Event
 InheritedDOM 2 Events cancelable : Boolean
[read-only] Indicates whether the event is cancelable or not.
Event
 InheritedDOM 2 Events currentTarget : EventTarget
[read-only] Identifies the current target for the event, as the event traverses the DOM.
Event
  HTML 5 data : *
[read-only] A string holding the message passed from the other window.
MessageEvent
 InheritedDOM 3 Events defaulPrevented : Boolean
[read-only] Used to indicate whether Event.preventDefault() has been called for this event.
Event
 InheritedDOM 2 Events eventPhase : Number
[read-only] Used to indicate which phase of event flow is currently being accomplished.
Event
 InheritedNon-Standard explicitOriginalTarget : nsIDOMEventTarget
[read-only] The explicit original target of the event.
Event
 InheritedNon-Standard isTrusted : Boolean
[read-only] Determines if the event was from the user or script generated.
Event
  HTML 5 lastEventId : DOMString
[read-only] Returns the last event ID, for server-sent events.
MessageEvent
 InheritedDOM 3 Events namespaceURI : DOMString
[read-only] The namespace URI associated with this event at initialization time, or null if it is unspecified.
Event
  HTML 5 origin : DOMString
[read-only] Returns the origin of the message, for server-sent events and cross-document messaging.
MessageEvent
 InheritedNon-Standard originalTarget : *
[read-only] The original target of the event before any retargetings.
Event
  HTML 5 ports : MessagePortArray
[read-only] Returns the MessagePortArray sent with the message, for cross-document messaging and channel messaging.
MessageEvent
  HTML 5 source : WindowProxy
[read-only] Returns the WindowProxy of the source window, for cross-document messaging.
MessageEvent
 InheritedDOM 2 Events target : EventTarget
[read-only] Used to indicate the event target.
Event
 InheritedDOM 2 Events timeStamp : DOMTimeStamp
[read-only] Used to specify the time at which the event was created in milliseconds relative to 1970-01-01T00:00:00Z.
Event
 InheritedDOM 2 Events type : DOMString
[read-only] The local name of the event type.
Event
Public Methods
 MethodDefined By
 Inherited
DOM 2 Events initEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean):void
Initializes attributes of an Event created through the DocumentEvent.createEvent method.
Event
 Inherited
DOM 3 Events initEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean):void
Initializes attributes of an Event object.
Event
  
HTML 5 initMessageEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, dataArg:DOMString, originArg:DOMString, lastEventIdArg:WindowProxy, sourceArg:MessagePortArray, portsArg:*):void
The initMessageEvent() must initialize the event in a manner analogous to the similarly-named methods in the DOM3 Events interfaces.
MessageEvent
  
HTML 5 initMessageEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, dataArg:DOMString, originArg:DOMString, lastEventIdArg:WindowProxy, sourceArg:MessagePortArray, portsArg:*):void
The initMessageEventNS() must initialize the event in a manner analogous to the similarly-named methods in the DOM3 Events interfaces.
MessageEvent
 Inherited
 Obsolete preventBubble():void
Prevents the event from bubbling.
Event
 Inherited
 Obsolete preventCapture():void
This method is deprecated in favor of standard stopPropagation and is removed in Gecko 1.9.
Event
 Inherited
DOM 2 Events preventDefault():void
Cancels the event if it is cancelable, without stopping further propagation of the event.
Event
 Inherited
DOM 3 Events stopImmediatePropogation():void
Prevents other event listeners from being triggered and, unlike Event.stopPropagation() its effect is immediate .
Event
 Inherited
DOM 2 Events stopPropogation():void
Prevents other event listeners from being triggered but its effect is deferred until all event listeners attached on the Event.currentTarget have been triggered .
Event
Public Constants
 ConstantDefined By
 InheritedHTML 4.0 abort : String = abort
[static] Loading of a resource has been aborted.
Event
 InheritedDOM 2 Events AT_TARGET : Number = 2
[static] The current event is in the target phase, i.e.
Event
 InheritedDOM 2 Events BUBBLING_PHASE : Number = 3
[static] The current event phase is the bubbling phase.
Event
 InheritedDOM 2 Events CAPTURING_PHASE : Number = 1
[static] The current event phase is the capture phase.
Event
 InheritedHTML 4.0 change : String = change
[static] A control loses the input focus and its value has been modified since gaining focus.
Event
 InheritedHTML 4.0 error : String = error
[static] A resource failed to load, or has been loaded but cannot be interpreted according to its semantics such as an invalid image, a script execution error, or non-well-formed XML.
Event
 InheritedHTML 4.0 load : String = load
[static] The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts).
Event
 InheritedHTML 4.0 reset : String = reset
[static] A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset.
Event
 InheritedHTML 4.0 select : String = select
[static] A user selects some text.
Event
 InheritedHTML 4.0 submit : String = submit
[static] A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted.
Event
 InheritedHTML 4.0 unload : String = unload
[static] The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts).
Event
Property Detail
HTML 5 dataproperty
data:*  [read-only]

Introduced in: DOM 3 Events 

A string holding the message passed from the other window.


Implementation
    public function get data():*

See also

HTML 5 lastEventIdproperty 
lastEventId:DOMString  [read-only]

Introduced in: DOM 3 Events 

Returns the last event ID, for server-sent events.


Implementation
    public function get lastEventId():DOMString

See also

HTML 5 originproperty 
origin:DOMString  [read-only]

Introduced in: DOM 3 Events 

Returns the origin of the message, for server-sent events and cross-document messaging.

The origin of the window that sent the message at the time postMessage was called. This string is the concatenation of the protocol and "://", the host name if one exists, and ":" followed by a port number if a port is present and differs from the default port for the given protocol. Examples of typical origins are http://example.org (implying port 443), http://example.net (implying port 80), and http://example.com:8080. Note that this origin is not guaranteed to be the current or future origin of that window, which might have been navigated to a different location since postMessage was called.


Implementation
    public function get origin():DOMString

See also

HTML 5 portsproperty 
ports:MessagePortArray  [read-only]

Introduced in: DOM 3 Events 

Returns the MessagePortArray sent with the message, for cross-document messaging and channel messaging.


Implementation
    public function get ports():MessagePortArray

See also

HTML 5 sourceproperty 
source:WindowProxy  [read-only]

Introduced in: DOM 3 Events 

Returns the WindowProxy of the source window, for cross-document messaging.


Implementation
    public function get source():WindowProxy

See also

Method Detail
HTML 5 initMessageEvent()method
public function initMessageEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, dataArg:DOMString, originArg:DOMString, lastEventIdArg:WindowProxy, sourceArg:MessagePortArray, portsArg:*):void

Introduced in: DOM 3 Events 

The initMessageEvent() must initialize the event in a manner analogous to the similarly-named methods in the DOM3 Events interfaces.

Parameters

typeArg:DOMString — Specifies Event.type, the local name of the event type.
 
canBubbleArg:Boolean — Specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
 
cancelableArg:Boolean — Specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
 
dataArg:DOMString — The message being sent.
 
originArg:DOMString — The origin of the document that sent the message (typically the scheme, hostname, and port of the document, but not its path or fragment identifier).
 
lastEventIdArg:WindowProxy — The last event ID string of the event source.
 
sourceArg:MessagePortArray — The WindowProxy of the browsing context of the Window object from which the message came.
 
portsArg:* — The MessagePortArray being sent, if any.

See also

HTML 5 initMessageEventNS()method 
public function initMessageEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, dataArg:DOMString, originArg:DOMString, lastEventIdArg:WindowProxy, sourceArg:MessagePortArray, portsArg:*):void

Introduced in: DOM 3 Events 

The initMessageEventNS() must initialize the event in a manner analogous to the similarly-named methods in the DOM3 Events interfaces.

Parameters

namespaceURIArg:DOMString — Specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace.
 
typeArg:DOMString — Specifies Event.type, the local name of the event type.
 
canBubbleArg:Boolean — Specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
 
cancelableArg:Boolean — Specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
 
dataArg:DOMString — The message being sent.
 
originArg:DOMString — The origin of the document that sent the message (typically the scheme, hostname, and port of the document, but not its path or fragment identifier).
 
lastEventIdArg:WindowProxy — The last event ID string of the event source.
 
sourceArg:MessagePortArray — The WindowProxy of the browsing context of the Window object from which the message came.
 
portsArg:* — The MessagePortArray being sent, if any.

See also