Does IndexedDB persist with a new service-worker?

Viewed 117

Does the indexedDB persist when I unregister a service worker and install a new one?

If I would manually unregister the service-worker like this

        navigator.serviceWorker
          .getRegistrations()
          .then(function (registrations) {
            for (let registration of registrations) {
              registration.unregister();
            }
          });
        window.location.reload();
      

what happens with the indexedDB that is created in my service worker? Is it dependent on the specific sw it was created in?

1 Answers

Unregistering a service worker does not affect site storage, and that includes IndexedDB and the Cache Storage API. All previously saved data will persist independent of a service worker registration.

Related