BroadcastChannel
BroadcastChannel allows same-origin browsing contexts (tabs, Workers) to broadcast messages through a named channel.
Purpose
To broadcast messages among same-origin tabs/Workers, achieving cross-tab synchronization without SharedWorker or storage events.
Mechanism
new BroadcastChannel(name) joins a named channel; postMessage broadcasts to all other instances on the same channel, and onmessage receives. Same-origin only; unavailable cross-origin.
Use cases
- Cross-tab synchronization
- State broadcasting
- Same-origin communication