Responds With A 200 When Offline

Why the audit is important

Progressive web apps work offline. If Lighthouse does not receive an HTTP 200 response when accessing a page while offline, then the page is not accessible offline.

How to pass the audit

  1. Add a service worker to your app.
  2. Use the service worker to cache files locally.
  3. When offline, use the service worker as a network proxy to return the locally cached version of the file.

To learn how to add a service worker into an existing app, see Adding a Service Worker and Offline Into Your Web App. Use what you learn in this step-by-step, hands-on codelab to learn how to add a service worker into your own app. This covers steps 1 and 3 above.

The codelab above shows you some basics on how to debug your service worker using Chrome DevTools. For more detailed help, see the codelab dedicated to this topic, Debugging Service Workers.

Use the Offline Cookbook to determine which caching strategy fits your app best. This covers step 2 above.

How the audit is implemented

This section explains how this audit is implemented, so that you can understand how the audit's score is calculated.

Lighthouse emulates an offline connection using the Chrome Debugging Protocol, and then attempts to retrieve the page using XMLHttpRequest.