Implement Cross-Tab Data Sharing Between Two Browser Windows in Real Time

Implement a mechanism to share and synchronize data between two or more browser tabs/windows of the same origin without a server. Explore and implement solutions using BroadcastChannel API, localStorage events, and SharedWorkers. Handle cases like one tab going offline, tab leader election, and state reconciliation when a new tab opens. This is used in SSO logout propagation, shared cart state, and real-time collaboration features.

Examples
Input: []
Output:
Hints

Implement Cross-Tab Data Sharing Between Two Browser Windows in Real Time

Implement a mechanism to share and synchronize data between two or more browser tabs/windows of the same origin without a server. Explore and implement solutions using BroadcastChannel API, localStorage events, and SharedWorkers. Handle cases like one tab going offline, tab leader election, and state reconciliation when a new tab opens. This is used in SSO logout propagation, shared cart state, and real-time collaboration features.