coderef

Channel messagingBaseline · Widely available

Channel messaging communicates one-to-one between browsing contexts on the same origin, such as between <iframe> elements or two documents using a shared worker.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 22, 2015. Widely available since Mar 22, 2018.

Browser support

DesktopChrome
1–3Not supported
4+Supportedsince Jan 25, 2010
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–40Not supported
41+Supportedsince Sep 22, 2015
Current: 157
Safari
1–4Not supported
5+Supportedsince Jun 7, 2010
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4–40Not supported
41+Supportedsince Sep 22, 2015
Current: 157
Safari iOS
1–4Not supported
4.2+Supportedsince Nov 22, 2010
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: MessageChannel.

Feature detection

JS · check before using
if ("MessageChannel" in globalThis) {
  // MessageChannel is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (11). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
MessageChannel21241518414.2
MessageChannel.MessageChannel21241518414.2
MessageChannel.port121241518414.2
MessageChannel.port221241518414.2
MessageEvent.ports412341843.2
MessagePort21241518414.2
MessagePort.close21241518414.2
MessagePort.message_event21241518414.2
MessagePort.postMessage21241518414.2
MessagePort.start21241518414.2
MessagePort.worker_support41241518414.2