Chapter 4. Intercepting network requests
Chapter 3 looked into using Service Worker caching to dramatically speed up the performance of your website. Instead of the user making a request to the server, the Service Worker intercepts the request and decides to serve it from cache instead. We also briefly touched on how to use Service Workers to transform the requests and responses made by the client using the fetch event.
In this chapter, we’ll dive deeper into the fetch event and you’ll learn more about the many use cases it offers. Service Workers are the key to unlocking the power that lies within your browser. By the end of the chapter, you’ll know how to serve lighter, leaner web pages depending on your user’s browser or preferences. In this section of the book, we’re focusing on the faster part of Progressive Web Apps (PWAs), although it’s important to also ensure that your web apps are resilient and engaging, too.