Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
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.
getRegistrations()None.
A Promise that resolves to an array of ServiceWorkerRegistration objects.
navigator.serviceWorker.getRegistrations().then((registrations) => {
document.querySelector("#status").textContent =
"ServiceWorkerRegistrations found.";
});