Immediate Claim

This recipe shows how to have the service worker immediately take control of the page without waiting for a navigation event.



Use Case

Basic service worker registration requires a navigation event to occur before the service worker starts working. This recipe illustrates a trick you can use for the service worker to immediately start working upon install.

Features and Usage

  • Register a service worker
  • Delete old cache if present
  • Immediately claim the service worker


General Usage

Has it been useful?

Tell us what you think of this recipe by leaving a comment!