If your client is using older and slower hardware, including older hard drives, there is a chance that accessing resources from a hard drive could be slower than accessing the same resources on a faster Internet connection. But just because some of your users are using slower hardware, it doesn't justify accessing resources already in the hardware over the network all the time, because some users may have faster hardware that could be a waste of data. To resolve this issue, we can implement a solution that performs a race condition, and fetch data according to which resolves first.
To get started with service workers, you will need to have the service worker experiment feature turned on in your browser settings. If you have not done this yet, refer to the first recipe of Chapter 1, Learning Service Worker Basics: Setting up service workers. Service workers only run across HTTPS. To find out how to set up a development environment to support...