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
.
get(id)
id
A string representing the id of the client you want to get.
self.clients.get(id).then(function(client) { self.clients.openWindow(client.url); });
Specification |
---|
Service Workers 1 # 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
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
|
No |
38 |
11.1 |
51 |
51 |
45 |
41 |
11.3 |
5.0 |
© 2005–2021 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