3 ms·
This doesn't reinvent HTTP caching: you should still set far-future expires headers on your JS and CSS. What HTTP caching doesn't solve for is caching markup in
by reissbaker 11y ago
This doesn't reinvent HTTP caching: you should still set far-future expires headers on your JS and CSS. What HTTP caching doesn't solve for is caching markup in dynamic pages: HTTP caching is entire-file or nothing.
With Service Workers you can cache the static parts of your templates (e.g the UI chrome) and render them immediately via JS rather than waiting for the initial document load. You then grab the rest of the dynamic content via an AJAX call. This leads to improved perceived performance, since you can immediately begin painting rather than showing a blank screen waiting for the document load.
Even with great HTTP caching, skipping the initial document load will always be faster (assuming that the document is dynamic, and thus can't be cached via HTTP caching). For plain static pages, of course, the existing web works super well, since that's what it was designed for.