Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.
The messageerror event is fired on a Window object when it receives a message that can't be deserialized.
This event is not cancellable and does not bubble.
Use the event name in methods like addEventListener(), or set an event handler property.
A MessageEvent. Inherits from Event.
Event MessageEventThis interface also inherits properties from its parent, Event.
MessageEvent.data Read onlyThe data sent by the message emitter.
MessageEvent.origin Read onlyA string representing the origin of the message emitter.
MessageEvent.lastEventId Read onlyA string representing a unique ID for the event.
MessageEvent.source Read onlyA MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
MessageEvent.ports Read onlyAn array of MessagePort objects representing the ports associated with the channel the message is being sent through (where appropriate, e.g., in channel messaging or when sending a message to a shared worker).
Listen for messageerror using addEventListener():
The same, but using the onmessageerror event handler property:
| HTML # event-messageerror |
| HTML # handler-window-onmessageerror |
Enable JavaScript to view this browser compatibility table.
This page was last modified on May 2, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.