Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
60
18
57
16.4
60
16.4

The messageerror event is fired on a MessagePort object when it receives a message that can't be deserialized.

60
18
57
16.4
60
16.4

The messageerror event is fired to the ServiceWorkerContainer when an incoming message sent to the associated worker can't be deserialized.

80
80
65
16.4
80
16.4

The messageerror event of the ServiceWorkerGlobalScope interface occurs when incoming messages can't be deserialized.

81
81
65
11.1
81
11.3

The messageerror event is fired on a Window object when it receives a message that can't be deserialized.

60
18
57
16.4
60
16.4

The messageerror event is fired on a Worker object when it receives a message that can't be deserialized.

18
57
16.4
16.4
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Removed
  • This feature was removed in a later browser version (79)
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (16.4)
Implementation note
  • Although the `onmessageerror` event handler property is supported, the `messageerror` event is never fired.
Notes 3 item(s)
Limitation
  • This browser only partially implements this feature
Removed
  • This feature was removed in a later browser version (16.4)
Implementation note
  • Although the `onmessageerror` event handler property is supported, the `messageerror` event is never fired.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Although the `onmessageerror` property is supported, the `messageerror` event is never fired. See bug 272967.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Although the `onmessageerror` property is supported, the `messageerror` event is never fired. See bug 272967.
Notes 1 item(s)
Removed
  • This feature was removed in a later browser version (79)

Syntax

JAVASCRIPT
// worker.js

self.addEventListener("messageerror", (event) => {
  self.postMessage("Error receiving message");
  console.error(event);
});

Use cases

  • Using messageerror

    The messageerror event is fired on a DedicatedWorkerGlobalScope object when it receives a message that can't be deserialized.

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.