Service Worker Development Cookbook
上QQ阅读APP看书,第一时间看更新

Introduction

You might have encountered, from time to time, having broken images appear on certain websites. This could be because of a number of reasons: the image might not have existed, it might not have been named properly, or the file path in the code might have been incorrect. Whatever the reason it might be, it could impact your website, and could lead the user to think that your website is broken.

Images are not the only resources that are essential to your website. Cascading style sheets (CSS), JavaScript files, and font files are also necessary to make your website appear functional. In this chapter, we are going to look at how to load these resources offline.

Before we start working on loading resources offline, let's find out how we can notify the user that the network is unavailable.