DedicatedWorkerGlobalScope: name property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2019.

Note: This feature is only available in Dedicated Web Workers.

The name read-only property of the DedicatedWorkerGlobalScope interface returns the name that the Worker was (optionally) given when it was created. This is the name that the Worker() constructor can pass to get a reference to the DedicatedWorkerGlobalScope.

Value

A string.

Examples

If a worker is created using a constructor with a name option:

js
const myWorker = new Worker("worker.js", { name: "myWorker" });

the DedicatedWorkerGlobalScope will now have a name of "myWorker", returnable by running

js
self.name;

from inside the worker.

Specifications

Specification
HTML
# dom-dedicatedworkerglobalscope-name-dev

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
name
Chrome – Full support
Chrome 70 (Release date: 2018-10-16)
footnote Full support
Edge – Full support
Edge 18 (Release date: 2018-10-02)
footnote Full support
Firefox – Full support
Firefox 55 (Release date: 2017-08-08)
footnote Full support
Opera – Full support
Opera 57 (Release date: 2018-11-28)
footnote Full support
Safari – Full support
Safari 12.1 (Release date: 2019-03-25)
footnote Full support
Chrome Android – Full support
Chrome Android 70 (Release date: 2018-10-17)
footnote Full support
Firefox for Android – Full support
Firefox for Android 55 (Release date: 2017-08-08)
footnote Full support
Opera Android – Full support
Opera Android 49 (Release date: 2018-12-07)
footnote Full support
Safari on iOS – Full support
Safari on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Samsung Internet – Full support
Samsung Internet 10 (Release date: 2019-08-22)
footnote Full support
WebView Android – Full support
WebView Android 70 (Release date: 2018-10-17)
footnote Full support
WebView on iOS – Full support
WebView on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also