Clients: get() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
Note: This feature is only available in Service Workers.
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
Examples
js
self.clients.get(id).then((client) => {
self.clients.openWindow(client.url);
});
Specifications
Specification |
---|
Service Workers # clients-get |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
get |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.