Serviceworker: Service workers registration lifetime

Created on 27 May 2016  路  4Comments  路  Source: w3c/ServiceWorker

I'm still unclear about the lifetime of a service worker's registration. What is its exact lifetime? In other words, how long can a registration remain alive without an update? Will a service worker permanently work without internet access after its very first registration?

question

All 4 comments

A registration persists unless it's unregistered: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-registration-lifetime

Every navigation tries an update but if it keeps failing the registration's active worker is used until an update is succeeded.

I think the one caveat though is that to get it truly persisted you also need to get https://storage.spec.whatwg.org/. Since we store registrations in the same box that localStorage and such go and those can go away under constraints.

And a user can always bypass the service worker with a hard refresh. Or wipe origin storage themselves, etc.

Thank you all for your very clear responses. They do help me a lot.

Was this page helpful?
0 / 5 - 0 ratings