The WindowOrWorkerGlobalScope mixin describes several features common to the Window and WorkerGlobalScope interfaces. Each of these interfaces can, of course, add more features in addition to the ones listed below.

Note: WindowOrWorkerGlobalScope is a mixin and not an interface; you can't actually create an object of type WindowOrWorkerGlobalScope.

Properties

These properties are defined on the WindowOrWorkerGlobalScope mixin, and implemented by Window and WorkerGlobalScope.

WindowOrWorkerGlobalScope.caches Read only
Returns the CacheStorage object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests.
WindowOrWorkerGlobalScope.indexedDB Read only
Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an IDBFactory object.
WindowOrWorkerGlobalScope.isSecureContext Read only
Returns a boolean indicating whether the current context is secure (true) or not (false).
WindowOrWorkerGlobalScope.origin Read only
Returns the origin of the global scope, serialized as a string.

Methods

These properties are defined on the WindowOrWorkerGlobalScope mixin, and implemented by Window and WorkerGlobalScope.

WindowOrWorkerGlobalScope.atob()
Decodes a string of data which has been encoded using base-64 encoding.
WindowOrWorkerGlobalScope.btoa()
Creates a base-64 encoded ASCII string from a string of binary data.
WindowOrWorkerGlobalScope.clearInterval()
Cancels the repeated execution set using WindowOrWorkerGlobalScope.setInterval().
WindowOrWorkerGlobalScope.clearTimeout()
Cancels the delayed execution set using WindowOrWorkerGlobalScope.setTimeout().
WindowOrWorkerGlobalScope.createImageBitmap()
Accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap. Optionally the source is cropped to the rectangle of pixels originating at (sx, sy) with width sw, and height sh.
WindowOrWorkerGlobalScope.fetch()
Starts the process of fetching a resource from the network.
WindowOrWorkerGlobalScope.setInterval()
Schedules a function to execute every time a given number of milliseconds elapses.
WindowOrWorkerGlobalScope.setTimeout()
Schedules a function to execute in a given amount of time.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'WindowOrWorkerGlobalScope mixin' in that specification.
Living Standard This is where the main mixin is defined.
Fetch
The definition of 'fetch()' in that specification.
Living Standard Definition of the fetch() method.
Service Workers
The definition of 'caches' in that specification.
Working Draft Definition of the caches property.
Indexed Database API 2.0
The definition of 'indexedDB' in that specification.
Recommendation Definition of the indexedDB property.
Secure Contexts
The definition of 'isSecureContext' in that specification.
Candidate Recommendation Definition of the isSecureContext property.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support54 ?52 ? ? ?
atob Yes Yes

1

271

572

10 Yes Yes
btoa Yes Yes

1

523

10 Yes Yes
caches40 ?

42

524

No ? No
clearInterval1 Yes

1

525

444
clearTimeout1 Yes

1

526

444
createImageBitmap50 No

42

527

No Yes No
fetch4214

39

348

529

No

29

2810

10
indexedDB

24

23 webkit

Yes

16

10 moz

5211

10157
isSecureContext55 ?52 ? ? ?
origin59 ?54 No No No
setInterval1 Yes

1

5212

441
setTimeout1 Yes

1

5212

441
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ?54 ?52 ? ? ?
atob Yes Yes ?

4

271

572

? Yes ?
btoa Yes Yes ?

4

522

? Yes ?
caches Yes Yes ?

42

524

Yes Yes ?
clearInterval11 Yes

4

525

61 ?
clearTimeout11 Yes

4

526

61 ?
createImageBitmap5050 ? ? Yes ? ?
fetch424214

39

348

529

?10 ?
indexedDB Yes ? Yes

22

5211

228 ?
isSecureContext5555 ?52 ? ? ?
origin5959 ?54 No No ?
setInterval11 Yes

4

5212

61 ?
setTimeout11 Yes

4

5212

61 ?

1. atob() ignores all space characters in the argument to comply with the latest HTML5 spec (see bug 711180).

2. atob() now defined on WindowOrWorkerGlobalScope mixin.

3. btoa() now defined on WindowOrWorkerGlobalScope mixin.

4. caches now defined on WindowOrWorkerGlobalScope mixin.

5. clearInterval() now defined on WindowOrWorkerGlobalScope mixin.

6. clearTimeout() now defined on WindowOrWorkerGlobalScope mixin.

7. createImageBitmap() now defined on WindowOrWorkerGlobalScope mixin.

8. From version 34: this feature is behind the dom.fetch.enable preference. To change preferences in Firefox, visit about:config.

9. fetch() now defined on WindowOrWorkerGlobalScope mixin.

10. From version 28: this feature is behind the Experimental Web Platform Features preference.

11. indexedDB now defined on WindowOrWorkerGlobalScope mixin.

12. setInterval now defined on WindowOrWorkerGlobalScope mixin.

See also

Document Tags and Contributors

 Contributors to this page: fscholz, kenrick95, Bzbarsky, chrisdavidmills
 Last updated by: fscholz,