ServiceWorkerContainer.getRegistrations()

The getRegistrations() method of the ServiceWorkerContainer interface gets all ServiceWorkerRegistrations associated with a ServiceWorkerContainer, in an array. The method returns a Promise that resolves to an array of ServiceWorkerRegistration.

Syntax

serviceWorkerContainer.getRegistrations().then(function(serviceWorkerRegistrations) { ... });

Parameters

None.

Return value

A Promise that resolves to an array of ServiceWorkerRegistration objects.

Example

navigator.serviceWorker.getRegistrations().then(function(registrations) {
  document.querySelector('#status').textContent = 'ServiceWorkerRegistrations found.';
});

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
getRegistrations
45
17
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
No
27
11.1
40
45
44
27
11.3
4.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/ServiceWorkerContainer/getRegistrations