W3cubDocs

/Web APIs

Clients: get() method

The get() method of the Clients interface gets a service worker client matching a given id and returns it in a Promise.

Syntax

js

get(id)

Parameters

id

A string representing the id of the client you want to get.

Return value

A Promise that resolves to a Client object or undefined.

Examples

js

self.clients.get(id).then((client) => {
  self.clients.openWindow(client.url);
});

Specifications

Browser compatibility

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