HTML onmessage Event Attribute


The event attribute onmessage is used when an object has received some message through an event source.

The event object for onmessage Event supports the following schemes:

  • data: It contains the actual message present inside it.
  • origin: It contains the URL of the document that invoked the event.
  • lastEventId: It works as descriptive attribute for the last message that was spotted in the message stream.


<element onmessage="script">


  • scriptThe name of the script to use when the event has been triggered.


Currently no example, check back again soon.

Browser Support

Explorer Edge Chrome Firefox Opera Safari
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung