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.
ServiceWorkerClients.matchAll(options).then(function(clients) {
// do something with your clients list
}); options OptionalincludeUncontrolled: 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.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.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
}
}
}); | Specification | Status | Comment |
|---|---|---|
| Service Workers The definition of 'Clients: matchall' in that specification. | Working Draft | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 47
|
? | 44
|
No | 32 | No |
includeUncontrolled option
|
47
|
? | 45
|
No | 38 | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 47
|
47
|
? | 44
|
32 | No | 4.0 |
includeUncontrolled option
|
47
|
47
|
? | 45
|
38 | No | 5.0 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Clients/matchAll