The BroadcastChannel interface represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel.

주의: 이 기능은 Web Worker에서 사용할 수 있습니다


BroadcastChannel() (en-US)

Creates an object linking to the named channel.


This interface also inherits properties from its parent, EventTarget. (en-US)

Returns a DOMString, the name of the channel.

Event handlers

BroadcastChannel.onmessage (en-US)

An event handler property that specifies the function to execute when a message event is fired on this object.

BroadcastChannel.onmessageerror (en-US)

An event handler called when a MessageEvent of type MessageError is fired—that is, when it receives a message that cannot be deserialized.


This interface also inherits methods from its parent, EventTarget.

BroadcastChannel.postMessage() (en-US)

Sends the message, of any type of object, to each BroadcastChannel object listening to the same channel.

BroadcastChannel.close() (en-US)

Closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected.



Fired when when a message arrives on the channel. Also available via the onmessage property.


Fired when a message arrives that can't be deserialized. Also available via the onmessageerror property.


HTML Standard
# broadcasting-to-other-browsing-contexts

Browser compatibility

BCD tables only load in the browser

See also