StealThis .dev
Pages Easy

Offline Page

A PWA offline fallback page with network detection, automatic reconnect polling, and a cached content list. Pure CSS + minimal JS.

Open in Lab
vanilla-js css
Targets: JS HTML

Code

Offline Page

A PWA offline fallback page served by the service worker when there is no network connection. Automatically polls for reconnection and shows recently cached pages.

Features

  • Animated WiFi signal illustration
  • Polls navigator.onLine and fetch to detect reconnection
  • Shows a list of recently cached pages the user can still access
  • Auto-redirects back to the original URL when reconnected

Service worker integration

Register this page as the offline fallback in your service worker:

// sw.js
self.addEventListener('fetch', event => {
  event.respondWith(
    fetch(event.request).catch(() => caches.match('/offline'))
  );
});

When to use it

  • Any PWA with a service worker
  • Apps that need graceful offline degradation