I stumbled upon this site the other day from Mozilla that’s a collection of recipes to get started with a Service Worker — from caching strategies and notifications to providing an offline fallback to your users, this little cookbook has it all.
Jeremy Keith has written a new book all about service workers and offline functionality that releases at the end of the month. The first chapter is posted on A List Apart. Now that the latest versions of iOS and macOS Safari support service workers, I can’t think of a better time to learn about how progressive web apps work under the hood. In fact, here's an example of a simple offline site and a short series on making web apps work offline.
News of Jeremy's book had me going back through his previous book, Resilient Web Design, where I half-remembered this super interesting quote from Chapter 4:
If you build something using web technologies, and someone visits with a web browser, you can’t be sure how many of the web technologies will be supported. It probably won’t be 100%. But it’s also unlikely to be 0%. Some people will visit with iOS devices. Others will visit with Android devices. Some people will get 80% or 90% of what you’ve designed. Others will get just 20%, 30%, or 50%. The web isn’t a platform. It’s a continuum.
I love this idea of the web as a continuum that’s constantly improving and growing over time and so I’m sure Jeremy’s latest book will be just as fun and interesting.
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.
I hadn't considered the fact that if you're fingerprinting your assets (e.g. style.987987090897.css) to take advantage of browser cache, you'll need to update your Service Worker every time you do that. But I guess you've got a build step anyway, so it can be updated in both places:
... we used a NodeJS module called Stacify to automatically create new version numbers in all the places when a file is changed.
A straightforward tutorial by Una Kravets on caching assets and individually requested articles with Service Workers for offline reading.
I'm curious what the best practice will become. It's possible that asking users to click something is it. Also possible: passively caching articles based on recently published, currently viewing, or related to currently viewing.
I finally figured out, it's an alien you can invite to live on user's browser.
I’ve been playing around with ServiceWorker a lot recently, so when Chris asked me to write an article about it I couldn’t have been more thrilled. ServiceWorker is the most impactful modern web technology since Ajax. It’s an API that lives inside the browser and sits between your web pages and your application servers. Once installed and activated, a ServiceWorker can programmatically determine how to respond to requests for resources from your origin, even when the browser is offline. ServiceWorker can be used to power the so-called "Offline First" web.
ServiceWorker is a progressive technology, and in this article, I'll show you how to take a website and make it available offline for humans who are using a modern browser while leaving humans with unsupported browsers unaffected.