The Cache-Only Strategy
Understand how the cache-only strategy works and when it is useful.
We'll cover the following
How it works
This strategy uses a service worker that listens to page requests via the fetch
event and responds to those requests from the cache.
Perform the following steps to implement the following strategy:
- Cache the static content (e.g., app shell) during the service worker’s
install
event. - Handle the page requests in the service worker’s
fetch
event. - Serve it from the cache even if the network is available—if the requested asset is from the app shell.
The slides given below illustrate the steps of this strategy:
Get hands-on with 1200+ tech skills courses.