It made the rounds a while back that Chris Bolin built a page of his personal website that could only be viewed while you are offline. Now he has a whole magazine around this same concept called The Disconnect!
This two-part series is a gentle introduction to offline web development. Getting a web application to do something while offline is surprisingly tricky, requiring a lot of things to be in place and functioning correctly. We’re going to cover all of these pieces from a high level, with working examples. This post is an overview, but there are plenty of more-detailed resources listed throughout.
- The Setup (you are here!)
- The Implementation
I’ll be making heavy use …
Making your web app work offline, Part 1: The Setup is a post from CSS-Tricks
This two-part series is a gentle, high-level introduction to offline web development. In Part 1 we got a basic service worker running, which caches our application resources. Now let’s extend it to support offline.
- The Setup
- The Implementation (you are here!)
Making an `offline.htm` file
Next, lets add some code to detect when the application is offline, and if so, redirect our users to a (cached) `offline.htm`.
But wait, if the service worker file is generated automatically, how …