This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The matchAll() method of the Clients interface returns a Promise for a list of service worker Client objects. Include the options parameter to return all service worker clients whose origin is the same as the associated service worker's origin. If options are not included, the method returns only the service worker clients controlled by the service worker.

Syntax

ServiceWorkerClients.matchAll(options).then(function(clients) {
  // do something with your clients list
});

Parameters

options Optional
An options object allowing you to set options for the matching operation. Available options are:
  • includeUncontrolled: A Boolean — if set to true, the matching operation will return all service worker clients who share the same origin as the current service worker. Otherwise, it returns only the service worker clients controlled by the current service worker. The default is false.
  • type: Sets the type of clients you want matched. Available values are window, worker, sharedworker, and all. The default is all.

Return value

Promise that resolves to an array of Client objects. In Chrome 46/Firefox 54 and later, this method returns clients in most recently focused order, correct as per spec.

Examples

clients.matchAll(options).then(function(clientList) {
  for (var i = 0 ; i < clientList.length ; i++) {
    if (clientList[i].url === 'index.html') {
      clients.openWindow(clientList[i]);
      // or do something else involving the matching client
    }
  }
});

Specifications

Specification Status Comment
Service Workers
The definition of 'Clients: matchall' in that specification.
Working Draft Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Edge ? Firefox Full support 44
Notes
Full support 44
Notes
Notes Service workers (and Push) have been disabled in the Firefox 45 & 52 Extended Support Releases (ESR).
Full support 54
Notes
Notes Client objects returned in most recent focus order.
IE No support NoOpera Full support 32Safari No support NoWebView Android Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Chrome Android Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Edge Mobile ? Firefox Android Full support 44
Full support 44
Full support 54
Notes
Notes Client objects returned in most recent focus order.
Opera Android Full support 32Safari iOS No support NoSamsung Internet Android Full support 4.0
includeUncontrolled option
Experimental
Chrome Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Edge ? Firefox Full support 45
Notes
Full support 45
Notes
Notes includeUncontrolled support.
IE No support NoOpera Full support 38Safari No support NoWebView Android Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Chrome Android Full support 47
Notes
Full support 47
Notes
Notes Client objects returned in most recent focus order.
Edge Mobile ? Firefox Android Full support 45
Notes
Full support 45
Notes
Notes includeUncontrolled support.
Opera Android Full support 38Safari iOS No support NoSamsung Internet Android Full support 5.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.

Document Tags and Contributors

Last updated by: sideshowbarker,