v140 · miscellaneous
SharedWorker on Android
For a long time, SharedWorker has been disabled on Android due to concerns about its unpredictable process lifecycle. We believed that SharedWorker instances might terminate unexpectedly, without noticing to users or web developers, which we considered unacceptable. However, a recent discussion on GitHub (https://github.com/whatwg/html/issues/11205) sugge
concepts
-
SharedWorker on Android
SharedWorker finally ships on Android. Multi-tab apps (chat, dashboards) can share state via a single worker instance instead of fanning out per-tab connections.
-
Cross-tab WebSocket
The flagship motivation: a single shared connection feeding 3 tabs. Working inline-blob SharedWorker with BroadcastChannel fallback when SW is missing.
-
Multi-tab Bus
Open this page in two windows; messages typed in one echo to the other via a shared rebroadcaster running in the SW. Foundation pattern.
-
Connection Counter
A live count of how many same-origin tabs are connected, using a Set of MessagePorts inside the SharedWorker. Reacts to opens and closes in real time.
-
Mobile Compatibility Tester
Feature-detects SharedWorker, runs a live ping test, and shows browser/platform info from
navigator.userAgentData. A platform matrix table shows Chrome desktop/Android/iOS, Firefox, and Safari support. A "build for Android first" code pattern shows SharedWorker → BroadcastChannel → localStorage events fallback chain.
why it shipped
The long-standing demand for SharedWorker support on Android stems from several needs expressed by web developers: - Resource Sharing and Efficiency: Developers aim to share a single WebSocket or Server-Sent Events (SSE) connection across multiple tabs, thereby conserving resources. - Persistent Resource Management: There's a strong desire to share and persist resources across tabs, particularly for technologies like WASM-based SQLite. - Closing a Feature Gap: It has been noted that other major mobile browsers, including Safari on iOS and Firefox on Android, already support SharedWorker, makin