This article needs a technical review. How you can help.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The matchAll() method of the Clients interface returns a Promise for a list of service worker clients. 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- An options object allowing you to set options for the matching operation. Available options are:
includeUncontrolled: ABoolean— if set totrue, 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 isfalse.type: Sets the type of clients you want matched. Available values arewindow,worker,sharedworker, andall. The default isall.
Returns
- A
Promisethat resolves to an array ofClientobjects. In Chrome 46 and later, this method returns clients in most recently used order.
Examples
clients.matchAll(options).then(function(clientList) {
for(var i = 0 ; i < clients.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' in that specification. |
Working Draft | Initial definition |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | 40.0[1] | 44.0 (44.0)[2][3] | No support | ? | No support |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|---|
| Basic support | No support | 40.0[1] | 44.0 (44.0) | (Yes) | No support | ? | No support | 40.0 |
- [1] The
includeUncontrolledoption is not supported before Chrome 43.0. - [2] The
includeUncontrolledoption is not supported before Firefox 45.0 (45.0). - [3] Service workers (and Push) have been disabled in the Firefox 45 Extended Support Release (ESR.)