coderef

Shared workerBaseline · Newly available

The SharedWorker() constructor runs a script in its own thread, which can send and receive messages with other scripts running at the same origin.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since May 5, 2026.

Browser support

DesktopChrome
1–4Not supported
5+Supportedsince May 25, 2010
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–28Not supported
29+Supportedsince Apr 29, 2014
Current: 157
Safari
1–15.6Not supported
16+Supportedsince Sep 12, 2022
Current: 27
MobileChrome Android
18–147Not supported
148+Supportedsince May 5, 2026
Current: 155
Firefox Android
4–32Not supported
33+Supportedsince Oct 14, 2014
Current: 157
Safari iOS
1–15.6Not supported
16+Supportedsince Sep 12, 2022
Current: 27

How to use

Every current browser supports this, but it only became Baseline on May 5, 2026. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: SharedWorker.

Feature detection

JS · check before using
if ("SharedWorker" in globalThis) {
  // SharedWorker is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (10). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
SharedWorker57929161483316
SharedWorker.SharedWorker57929161483316
SharedWorker.SharedWorker.mime_checks✕✕8116✕8116
SharedWorker.SharedWorker.options_name_parameter707955✕14855✕
SharedWorker.error_event57929161483316
SharedWorker.port57929161483316
SharedWorkerGlobalScope47929161482916
SharedWorkerGlobalScope.close47929161482916
SharedWorkerGlobalScope.connect_event47929161482916
SharedWorkerGlobalScope.name47929161482916