coderef

Dedicated workersBaseline · Widely available

The Worker() constructor runs a script in its own thread, which can send and receive messages with the script that created it. Also known as web workers.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.

Browser support

DesktopChrome
1–3Not supported
4+Supportedsince Jan 25, 2010
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–3.6Not supported
4+Supportedsince Mar 22, 2011
Current: 157
Safari
1–3.1Not supported
4+Supportedsince Jun 8, 2009
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157
Safari iOS
1–4.2Not supported
5+Supportedsince Oct 12, 2011
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: DedicatedWorkerGlobalScope.

Feature detection

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

Sub-features

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

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
DedicatedWorkerGlobalScope4123.541845
DedicatedWorkerGlobalScope.close4123.541845
DedicatedWorkerGlobalScope.name70185512.1705512.2
Worker2123.541845
Worker.Worker4123.541845
Worker.Worker.mime_checks✕✕8116✕8116
Worker.Worker.options_name_parameter70185512.1705512.2
Worker.error_event4123.541845
Worker.terminate2123.541845
Worker.worker_support✕✕34✕✕34✕
WorkerGlobalScope4123.541845
WorkerGlobalScope.error_event4123.541845
WorkerGlobalScope.importScripts412441845
WorkerGlobalScope.importScripts.mime_checks71796716716716
WorkerGlobalScope.location4123.541845
WorkerGlobalScope.navigator4173.541845
WorkerGlobalScope.rejectionhandled_event49796911497911
WorkerGlobalScope.self4123.5418345
WorkerGlobalScope.unhandledrejection_event49796911497911
WorkerLocation4123.541845
Show 11 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
WorkerLocation.hash4123.541845
WorkerLocation.host4123.541845
WorkerLocation.hostname4123.541845
WorkerLocation.href4123.541845
WorkerLocation.origin38142910382910
WorkerLocation.pathname4123.541845
WorkerLocation.port4123.541845
WorkerLocation.protocol4123.541845
WorkerLocation.search4123.541845
WorkerLocation.toString4123.541845
WorkerNavigator4123.541845