Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To make a website usable without an internet connection, serve it over HTTPS, register a service worker, precache the files required for the basic interface, and return cached responses when network requests fail. Add a deliberately designed offline page for uncached navigations. A web app manifest can describe installation and appearance, but it does not cache pages or provide offline behavior by itself.

The result can range from a simple outage message to a genuinely offline-capable application. Decide which pages, data and actions must work without connectivity before writing the cache rules.

Decide what “offline” means for your site

Offline support is not a switch that makes every URL and server feature continue working. Browsers can only display resources that have already reached the device and been stored locally. Define the intended experience in concrete terms:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Offline fallback: show a small page explaining that the connection is unavailable.
  • Offline content site: open the application shell and selected, previously saved pages or reference material.
  • Offline application: read local records, accept edits, and synchronize them later with conflict handling.

A brochure site may only need its home page, navigation, styles, scripts, icons and an offline.html page. A field application may need an explicit download feature for records, forms or manuals. Write down which operations must work offline and which should honestly display an unavailable state.

#1 Best Overall
RoamWiFi Mobile Hotspot Pocket WiFi, Portable WiFi No SIM Card Needed, MiFi
  • 【Global Seamless Roaming with a Variety of Data Plans】RoamWiFi offers seamless, high-speed connectivity in 170+ countries. Enjoy stable networks worldwide without SIM changes or international roaming fees. We provide diverse data plans for short-term travel to long-term stays. RoamWiFi lets you browse social media, make video calls, and work online worry-free.
  • 【Multi-Device Sharing and Intelligent Network Optimization】RoamWiFi supports simultaneous connections for up to 10 devices, including smartphones, tablets, laptops, gaming consoles, etc., providing convenient internet access for your family and friends during travels. Furthermore, equipped with advanced intelligent network selection technology, RoamWiFi automatically detects and connects to the optimal network signal from various carriers to ensure the best online experience wherever you go.
  • 【Ultimate Portability and Long Battery Life】 Designed to be compact and lightweight, RoamWiFi is easy to carry, fitting comfortably in your pocket or backpack. Its powerful battery life also means you don't need to charge it frequently, ensuring a prolonged online experience. Whether you're traveling, at home, or gaming, RoamWiFi is your ideal companion.
  • 【Built-in Data Plan with 30 Days Validity】 RoamWiFi offers an exclusive built-in data plan that includes 1GB of local data valid across the United States (US), Canada (CA), and Mexico (MEX)
  • 【No Contract or SIM Card Required, Easy to Use】RoamWiFi needs no contract or SIM card; just power on for automatic internet connection with no complex settings. Our 24/7 customer support ensures a hassle-free experience. Perfect for travel or daily use, RoamWiFi brings digital convenience to your life. For any issues, please contact our customer service first; we're dedicated to resolving them promptly.

Prerequisites: HTTPS, scope and a first online visit

Production service workers require a secure context, normally HTTPS. MDN’s service-worker guidance notes that localhost is supported for development. Register the worker from a URL whose directory scope covers the pages you want it to control; a worker at /app/sw.js does not automatically control the entire origin.

Offline support also requires an initial online visit. Installation must fetch the files and put them in Cache Storage before a later outage can use them. A visitor who has never loaded the site cannot receive resources from a device that has no connection.

Build a minimal offline shell

1. Add an offline page

Create a small page that has no dependency on uncached fonts, analytics or API calls:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>You’re offline</title>
<body>
  <main>
    <h1>You’re offline</h1>
    <p>This page could not be loaded. Check your connection and try again.</p>
    <button onclick="location.reload()">Try again</button>
  </main>
</body>
</html>

2. Register the service worker

Place this in the page JavaScript, after confirming that the browser supports service workers:

if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {
    navigator.serviceWorker.register('/sw.js', { scope: '/' })
      .then(registration => {
        console.log('Service worker registered:', registration.scope);
      })
      .catch(error => {
        console.error('Service-worker registration failed:', error);
      });
  });
}

The worker controls pages after its lifecycle completes. The first load may therefore need a refresh before the page is controlled; do not treat that normal lifecycle detail as a failed cache.

Rank #2
Statelinker S2 Portable WiFi Hotspot,10GB Free USA Data 4g LTE Mobile MiFi
  • North America-Exclusive 4G WiFi Device : Designed specifically for users across North America, this portable WiFi device offers seamless, high-speed internet without the need for a physical SIM card. Say goodbye to carrier restrictions and hidden roaming fees—enjoy reliable 4G connectivity wherever you go, with no contracts or commitments. Whether you're on a cross-country road trip or working remotely, this device ensures you stay connected effortlessly.
  • WiFi 6 Technology : Equipped with advanced WiFi 6 capabilities, this portable wifi router delivers faster speeds, improved efficiency, and better performance in crowded network environments. This mobile hotspot device supports simultaneous connections for up to 8 devices, making it perfect for families, small teams, or group travelers. Stream, browse, and work without interruptions, even in high-demand situations.
  • Portable & All-Day Battery Life : Compact and lightweight at just 100 grams(3.5ounce), this pocket-sized device is easy to carry wherever you go. Despite its small size, it packs a powerful battery that provides up to 15 hours of continuous use on a single charge. Whether you're hiking, camping, or working remotely, you can rely on all-day connectivity without needing to recharge.
  • Smart Features for Easy Management : Stay in control of your data usage with the built-in display screen, which shows real-time updates on your remaining data. simply glance at the screen to monitor your usage. Plus, every new hotspot device comes with 10GB of complimentary data, so you can start using it right out of the box,it’s a great way to test the service and enjoy instant connectivity during your first trip or busy workday.
  • Perfect for Every Lifestyle : From long-haul truck drivers and frequent travelers to outdoor enthusiasts and business professionals, this versatile mobile hotspot WiFi solution adapts to your needs. Whether you're navigating remote highways, exploring national parks, or managing work on the go, it provides dependable, high-speed internet to keep you connected to what matters most.

3. Precache the minimum application shell

Use a versioned cache name and add only files needed to start the interface. The following worker precaches the shell and removes old cache versions during activation:

const CACHE_NAME = 'site-shell-v1';
const CORE_ASSETS = [
  '/',
  '/index.html',
  '/styles.css',
  '/app.js',
  '/offline.html',
  '/icons/icon-192.png'
];

self.addEventListener('install', event => {
  event.waitUntil(
    caches.open(CACHE_NAME)
      .then(cache => cache.addAll(CORE_ASSETS))
      .then(() => self.skipWaiting())
  );
});

self.addEventListener('activate', event => {
  const keep = new Set([CACHE_NAME]);
  event.waitUntil(
    caches.keys()
      .then(names => Promise.all(
        names.filter(name => !keep.has(name))
             .map(name => caches.delete(name))
      ))
      .then(() => self.clients.claim())
  );
});

If any URL in addAll() fails, installation fails. Check paths, case sensitivity and HTTPS responses before adding more files. Keep cache names or manifests tied to your release process so a new deployment can deliberately replace old assets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Intercept requests with the right strategy

A service worker handles requests in the fetch event. Select behavior per resource rather than applying one rule to the entire site.

Resource or need Starting strategy Trade-off
Versioned CSS, JavaScript, icons and fixed shell files Precache or cache-first Fast and available offline, but an update policy is needed to avoid stale code.
Frequently changing pages or records Network-first with cached fallback Fresher online, but slower or unavailable offline if no response was saved.
Optional, large reference material User-directed download The user chooses what to retain; the UI must show progress and storage failures.
Failed page navigation Pre-cached offline fallback Explains the outage but cannot recreate missing page content.

Cache-first for stable assets

self.addEventListener('fetch', event => {
  const request = event.request;
  const url = new URL(request.url);

  if (request.method !== 'GET' || url.origin !== self.location.origin) return;
  if (!url.pathname.endsWith('.css') &&
      !url.pathname.endsWith('.js') &&
      !url.pathname.match(/.(png|jpg|jpeg|webp|svg|ico)$/)) return;

  event.respondWith(
    caches.match(request).then(cached => {
      if (cached) return cached;
      return fetch(request).then(response => {
        if (response.ok) {
          const copy = response.clone();
          caches.open(CACHE_NAME).then(cache => cache.put(request, copy));
        }
        return response;
      });
    })
  );
});

Cache-first is appropriate only when returning an older response is acceptable. Use filename hashes, a changed cache name, or another release mechanism to ensure updated code is eventually installed.

Network-first for changing documents

async function networkFirst(request) {
  const cache = await caches.open(CACHE_NAME);
  try {
    const response = await fetch(request);
    if (response.ok) await cache.put(request, response.clone());
    return response;
  } catch (error) {
    const cached = await cache.match(request);
    if (cached) return cached;
    throw error;
  }
}

self.addEventListener('fetch', event => {
  const request = event.request;
  const url = new URL(request.url);
  if (request.method === 'GET' && url.origin === self.location.origin &&
      request.mode === 'navigate') {
    event.respondWith(
      networkFirst(request).catch(() => caches.match('/offline.html'))
    );
  }
});

This example attempts the network for navigations, serves a saved copy when one exists, and finally returns the fallback page. If you cache API responses, use a separate data cache and an explicit freshness policy so document and data lifecycles do not interfere.

Rank #3
Sale
Roam 6 AX1500 Portable Wi-Fi 6 Travel Router Dual-Band USB C 3.0
  • 𝐑𝐨𝐚𝐦 𝟔 𝐀𝐗𝟏𝟓𝟎𝟎 𝐝𝐮𝐚𝐥-𝐛𝐚𝐧𝐝 𝐬𝐩𝐞𝐞𝐝𝐬 - Wi-Fi 6 Speeds up to 1,201 Mbps (5 GHz) and 300 Mbps (2.4 GHz) for up to 60 devices simultaneously. Actual Wi-Fi speeds vary based on source bandwidth, environment, distance to devices, and obstacles. ◇§
  • 𝐏𝐨𝐫𝐭𝐚𝐛𝐥𝐞 𝐚𝐧𝐝 𝐝𝐮𝐫𝐚𝐛𝐥𝐞 𝐝𝐞𝐬𝐢𝐠𝐧 - Roam 6 AX1500 is a pocket-sized travel router compactly designed for trips and adventures, featuring a 1 Gbps WAN/LAN port and a 1 Gbps LAN port for reliable wired connectivity.
  • 𝗦𝗲𝗰𝘂𝗿𝗲 𝗪𝗶-𝗙𝗶 𝗼𝗻-𝘁𝗵𝗲-𝗴𝗼 - Connects to public Wi-Fi and creates a private, secure network for all your devices. Supports multiple devices at once, ideal for hotels, Airbnbs, airports, and even home use. VPN connectivity enables secure remote work.
  • 𝐌𝐮𝐥𝐭𝐢𝐩𝐥𝐞 𝐰𝐚𝐲𝐬 𝐭𝐨 𝐜𝐨𝐧𝐧𝐞𝐜𝐭 - (1) Router Mode: Connects to public Wi-Fi, ISP, or phone (USB tethering). (2) AP/RE/Client Mode: Adds WiFi to wired setups, extends WiFi, or connects wired devices wirelessly.
  • 𝐎𝐮𝐫 𝐜𝐲𝐛𝐞𝐫𝐬𝐞𝐜𝐮𝐫𝐢𝐭𝐲 𝐜𝐨𝐦𝐦𝐢𝐭𝐦𝐞𝐧𝐭 - TP-Link is a signatory of the U.S. Cybersecurity and Infrastructure Security Agency’s (CISA) Secure-by-Design pledge. Advanced security is integrated into the device’s design, development, and ongoing maintenance.

Design data and offline edits separately

Cache Storage stores request/response pairs; it is not a complete database or synchronization system. For read-only data, preload a known dataset or let the user download it and show its saved date. For larger optional content, provide a “Download for offline use” control, progress indicator, cancellation path and a way to remove the download.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Editable offline applications need additional decisions:

  • Persist drafts or queued mutations in a client-side data store.
  • Give each change an identifier and a retry policy.
  • Define what happens when the server changed the same record.
  • Show pending, synchronized and failed states instead of silently losing work.
  • Retry when connectivity returns, while preventing duplicate submissions.

Do not claim that a cached interface makes payments, authentication, live search, server validation or form submission work offline. Implement a local equivalent or state clearly that those operations require a connection.

Manifest versus offline support

A web app manifest describes app name, icons, colors, display mode and related installation metadata. It does not download pages or intercept requests. Offline responses come from a service worker and local storage rules. You can add a manifest for installability while keeping the offline implementation independent; see MDN’s installability guide.

Updates, storage limits and reliability

Change the cache version when shell files change, delete obsolete caches during activation, and test the transition from an old worker to a new one. Avoid forcing an immediate takeover unless you understand the risk of an old page being paired with new assets. A clear “new version available” flow can let users reload at a safe point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
SIMO Solis Hero, 4G Mobile Hotspot, 1GB/Monthly + 30GB Global Data
  • 2-in-1 Solution: The SIMO Hero features a powerful hotspot device along with an 5250mAH powerbank built-in. Note: For best results please use the charging cable included.
  • Optimized to Share WiFi: Confidently connect up to 10 devices simultaneously.
  • SignalScan AI: Easily find the strongest signal across multiple mobile carriers – No SIM and No Locked-In Contracts Needed.
  • Global Coverage: SIMO delivers WiFi in 140 countries with 300+ carriers worldwide.
  • Two Data Packs Included: Each SIMO device comes bundled with 1GB of Free Data every month, forever (12GB Yearly) along with a one-time 30GB pack of Global Data (30GBs expires in 30 days)

Browser storage is not a permanent guarantee and available space varies by browser, device and user settings. Handle failed writes, quota pressure and eviction as normal states. Keep the core small, allow optional downloads to be removed, and never rely on one cached copy of irreplaceable user data.

Test the failure modes users will encounter

  1. Load the site online in a clean browser profile and confirm installation succeeds.
  2. Reload once, then use the browser’s offline or network-throttling mode.
  3. Open a precached route, an uncached route and a route with a cached previous response.
  4. Make an API request offline and verify the UI reports unavailable data rather than showing a misleading success.
  5. Submit or edit content offline and test persistence, retry and conflict behavior if those features exist.
  6. Restore connectivity and confirm queued work, fresh content and failed requests recover safely.
  7. Deploy a changed shell, verify old caches are removed, and test a user who still has the previous worker.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The worker never registers

Check that the page and worker use HTTPS (or localhost), that the script URL is same-origin, and that the worker scope includes the page. Inspect the browser’s Application or Storage panel for registration errors.

Installation fails

One failed URL can reject cache.addAll(). Open every listed asset directly, check for 404, redirect and certificate errors, and add only responses that can be fetched in the worker’s context.

The offline page is not shown

Navigation fallback code must call event.respondWith() for navigation requests and the fallback itself must be precached. A cached stylesheet or shell file alone does not handle an uncached document request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Old JavaScript keeps appearing

Use a new cache name or hashed asset filenames, remove obsolete caches in activate, and verify that the new worker has installed. Clear site data only as a diagnostic step; it hides lifecycle mistakes rather than fixing them.

Best Value
Sale
TP-Link Roam 6 AX1500 Portable Wi-Fi 6 Travel Router (TL-WR1502X)
  • 𝐑𝐨𝐚𝐦 𝟔 𝐀𝐗𝟏𝟓𝟎𝟎 𝐃𝐮𝐚𝐥-𝐁𝐚𝐧𝐝 𝐓𝐫𝐚𝐯𝐞𝐥 𝐑𝐨𝐮𝐭𝐞𝐫 - Delivers fast Wi-Fi 6 speeds (1201 Mbps on 5 GHz, 300 Mbps on 2.4 GHz) for uninterrupted video streaming, downloading, and online gaming all at the same time. Actual Wi-Fi speeds vary based on source bandwidth, environment, and distance to devices.
  • 𝐒𝐞𝐜𝐮𝐫𝐞 𝐖𝐢-𝐅𝐢 𝐎𝐧-𝐓𝐡𝐞-𝐆𝐨 - Connects to public Wi-Fi and creates a private, secure network for all your devices. Supports multiple devices at once, ideal for hotels, Airbnbs, airports, and even home use. VPN connectivity enables secure remote work. This is not a Mi-Fi device or mobile hotspot.
  • 𝐂𝐨𝐧𝐧𝐞𝐜𝐭 𝐀𝐧𝐲𝐰𝐡𝐞𝐫𝐞, 𝐀𝐧𝐲 𝐖𝐚𝐲 - Offers (1) Router Mode for Ethernet or USB (phone) tethering connections, (2) Hotspot Mode for secure access to public WiFi , and (3) AP/RE/Client Mode to extend WiFi, add WiFi to wired setups, or connect wired devices wirelessly.
  • 𝐏𝐨𝐫𝐭𝐚𝐛𝐥𝐞 𝐚𝐧𝐝 𝐃𝐮𝐫𝐚𝐛𝐥𝐞 𝐃𝐞𝐬𝐢𝐠𝐧 - The Roam 6 AX1500, measuring a compact 4.09 in. × 3.54 in. × 1.10 in., is a pocket-sized travel router perfect for your next trip or adventure.
  • 𝐌𝐮𝐥𝐭𝐢𝐩𝐥𝐞 𝐰𝐚𝐲𝐬 𝐭𝐨 𝐩𝐨𝐰𝐞𝐫 𝐲𝐨𝐮𝐫 𝐫𝐨𝐮𝐭𝐞𝐫 - Power the Roam 6 via its USB-C port using the included adapter or any 5V/3A PD power source, like a power bank.

API data is empty offline

The API response was probably never cached, was stored under a different request, or was intentionally treated as network-only. Define which records are downloadable and provide an explicit empty, stale or unavailable state.

Or skip the browser setup

If your goal is to create screenshots of pages while developing or testing an offline experience, ScreenshotNeo provides a website screenshot API and MCP server. It is separate from your site’s offline architecture, but can capture a target URL with one request. Cookie and consent banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed, and each response identifies the page verdict and billing result.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for options such as full-page capture, device and viewport settings, custom CSS and JavaScript, waiting for selectors or network idle, request blocking, caching, PDFs, bulk capture and signed webhooks. Its MCP server includes take_screenshot, get_page_info and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Further reading

Frequently Asked Questions

Will offline support work on a visitor’s first visit?

No. The service worker must first download and cache the required resources while the device is online.

Can I cache every page automatically?

You can technically intercept many requests, but indiscriminate caching creates stale content, unnecessary storage use and unclear behavior. Select resources according to the offline task.

How can users know cached data is old?

Store or display a retrieval timestamp and label saved records as offline or stale when your freshness rules require it.

Does a service worker replace server-side synchronization?

No. Offline edits require local persistence, retry logic, authentication decisions and conflict resolution designed by the application.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 4
SIMO Solis Hero, 4G Mobile Hotspot, 1GB/Monthly + 30GB Global Data
SIMO Solis Hero, 4G Mobile Hotspot, 1GB/Monthly + 30GB Global Data
Optimized to Share WiFi: Confidently connect up to 10 devices simultaneously.; Global Coverage: SIMO delivers WiFi in 140 countries with 300+ carriers worldwide.
$179.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.