BroadcastChannel is a publish/subscribe bus for one origin: every tab, iframe and worker that opens a channel with the same name receives each message, except the sender. It needs no server and no port passing, and it is Baseline Widely available. A classic use is logging out every tab at once.
const channel = new BroadcastChannel('auth');
channel.onmessage = ({ data }) => console.log(`${location.hash} got`, JSON.stringify(data));
const logout = () => channel.postMessage({ type: 'logout', at: new Date().toISOString() });
if (location.hash === '#tab-A') setTimeout(logout, 500);Output
#tab-C got {"type":"logout","at":"2026-09-15T16:43:13.362Z"}
#tab-B got {"type":"logout","at":"2026-09-15T16:43:13.362Z"}Messages are structured clones, so functions cannot be sent. Call channel.close() when a component unmounts.