THE GITHTML FIELD GUIDE

Why a website's service worker does not travel with saved HTML

A service worker belongs to a registered web origin and scope; it is not automatically packaged into a copied HTML document. A site's offline behavior therefore does not prove that the exported file will work in another reader. Evaluate the reading artifact itself and preserve essential content without depending on the original site's worker.

Identify the hidden dependency

The live site may answer requests from a managed cache even while the network is unavailable. A copied file in a different context does not inherit that registration, cache, or update logic.

Suppose an installed documentation app opens yesterday's pages during a network outage. That experience may depend on resources previously cached by a service worker for the original website. A separately downloaded report has a different lifecycle and may be opened under a different origin or file context. Write two distinct acceptance statements: the hosted app can perform specified tasks after preparation, and the exported artifact contains specified reading material. Do not use success on the first statement as evidence for the second. The distinction matters most when a report includes data fetched after its initial page shell appears.

Prepare the intended reading copy

Treat the hosted application's offline experience and the portable document as separate deliverables. Do not ask readers to enable scripts or register a worker merely to read a report. Export the required values, figures, and explanations into a deliberate static copy.

Prepare the export from the content the reader actually needs, including selected values, figure captions, and the observation time. Replace application controls that require the original worker or server with honest static labels or ordinary document navigation. If a link points back to the hosted app, identify it as an online continuation rather than implying the interaction is included. Do not attempt to transplant a worker registration into an HTML reader as a packaging shortcut. That changes the technical and trust model and still does not establish that all necessary resources or update behavior are available.

  1. Identify whether the original offline behavior depends on a service-worker registration.
  2. Separate hosted-app guarantees from the contents of the exported file.
  3. Test the reading copy without the original origin's cached application state.
text
Two checks: hosted application offline behavior; independent exported-document offline behavior.

Verify the offline result

Test the artifact in a context that has not previously visited the site. A warmed application cache can otherwise produce a false pass.

Use a fresh browser profile or another approved clean reading context for the artifact test without deleting the user's existing application data. Disconnect connectivity and inspect content near the end as well as the opening. If the page only works in the warmed original app, record that dependency instead of calling the export offline-ready. Preserve the hosted-app test separately so both products have evidence appropriate to their actual behavior.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All offline reading guides →

Read as MarkdownAll guides

Why a website's service worker does not travel with saved HTML · gitHtml