> The service worker below caches the HTML and CSS that's needed to render the page.
Why would you need a service worker for this? Doesn't the regular browser cache achieve the same thing?
Why would you need a service worker for this? Doesn't the regular browser cache achieve the same thing?
I don't think that's what the example is showing, though.
Do you know what the advantage of that is over serving the full cached HTML page layout and then fetching the content HTML from inside the page?
Service workers give you more control about what's in the cache, for example you can serve a stale version of the HTML and then fetch an up-to-date version in the background. But since last year you can also use `Cache-Control: max-age=1234, stale-while-revalidate=86400`, so it should be possible with the HTTP cache as well now.