The get() method of the Clients interface gets a service worker client matching a given id and returns it in a Promise.
The get() method of the Clients interface gets a service worker client matching a given id and returns it in a Promise.
js
get(id)
idA string representing the id of the client you want to get.
js
self.clients.get(id).then((client) => { self.clients.openWindow(client.url); });
| Specification |
|---|
| Service Workers # clients-get |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
get |
51 | 17 | 45 | No | 38 | 11.1 | 51 | 51 | 45 | 41 | 11.3 | 5.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Clients/get