Chapter 9. Boosting performance with service workers

 

This chapter covers

  • Understanding what service workers are and what they allow you to do
  • Installing a service worker on a simple site
  • Caching network requests inside a service worker
  • Updating a service worker

As the web has matured, so too has the technology that it relies on. No longer are we tied to our desks while browsing the web. With the advent of mobile devices, people are accessing content on Wi-Fi and data networks of varying degrees of quality and reliability. This introduces challenges in the way we access content, particularly in the case of poor or absent internet connections that may leave the user in a lurch.

Sometimes we go offline—in an airplane without Wi-Fi, or passing through a tunnel in a car or train, for example. It’s a fact of life. When this happens, we’re somewhat used to being unable to view content on websites. But it doesn’t have to be this way, and this is where service workers enter the picture.

In this chapter, you’ll learn about service workers: how they work, how to use them to intercept network requests, and how they can be used to cache site assets for times when your device is offline. Beyond the mere convenience of providing an offline experience to your users, you’ll also learn of the performance benefits that can come with using service workers, which can make repeat visits to your website even faster than before.

9.1. What are service workers?

 
 
 
 

9.2. Writing your first service worker

 
 
 

9.3. Updating your service worker

 
 

9.4. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest