PWA Offline Design
Project workbook · Path 94

Build a small local offline-reference prototype with a scoped service worker, a cache list and an update test plan.

The case

A fictional fieldbook contains one static lesson and a checklist. Cache only the application shell and this public lesson. Do not cache private account responses or arbitrary external pages. The first visit still needs the files to load before offline availability can be tested.

ResourceOffline policy
index.htmlprecache
app.jsprecache
styles.cssprecache
Private account datanot part of this app
STAGE 1

Define the offline promise

Start with a narrow offline experience and tell users its limits. A static reference is simpler than synchronizing edits across devices. Define which assets are available after a successful first load and which are not. The exercise stores no personal account data and makes no background network changes.

Your task

Write the offline contract and asset inventory.

Required output

Offline specification

Record your result and evidence here or in a separate file.

Review gate

The contract distinguishes first load from a later offline visit.

If the gate is not met

Remove claims that an uncached page can work without a network.

STAGE 2

Understand worker lifecycle and scope

A service worker is registered for a scope and has an installation and activation lifecycle. Cache a short explicit asset list and use a versioned cache name. Do not register the worker at a broader scope than needed. Keep the example isolated so it cannot alter unrelated pages during local testing.

Your task

Register the worker from the project folder and inspect its scope.

Required output

Worker source and scope record

Record your result and evidence here or in a separate file.

Review gate

The worker controls only the local project path.

If the gate is not met

Use relative registration and avoid a site-root scope override.

STAGE 3

Choose a serving strategy

For this static shell, a cache-first strategy is easy to inspect, with a network fallback for uncached same-origin GET requests. Do not cache every response indiscriminately. Explain how a new version becomes visible and what happens if an asset was not cached successfully. A strategy is a trade-off, not a universal best practice.

Your task

Implement the bounded fetch handler and an offline status message.

Required output

Serving behavior

Record your result and evidence here or in a separate file.

Review gate

Unsupported requests are not silently stored in the project cache.

If the gate is not met

Filter method and origin before handling a request.

STAGE 4

Plan updates and cleanup

An updated worker can wait while an older page remains controlled. Test the lifecycle instead of forcing reloads without understanding state. Remove only caches owned by this project and preserve unrelated browser data. A cache name prefix makes that boundary explicit. The example is not a synchronization system.

Your task

Change one lesson line and rehearse the version-update steps.

Required output

Update test plan

Record your result and evidence here or in a separate file.

Review gate

Cleanup targets only the project cache prefix.

If the gate is not met

Do not delete all origin caches as a shortcut.

STAGE 5

Verify and describe the result

A meaningful offline test loads online, confirms worker control, disables the network and reloads. Record actual observations and any browser restrictions. Local success does not establish installability on every platform. Keep native-site review separate from this standalone prototype and do not claim a live WikiFree PWA deployment.

Your task

Run the online-to-offline checklist and record the browser used.

Required output

Offline evidence log

Record your result and evidence here or in a separate file.

Review gate

The log distinguishes prepared source, local test and production deployment.

If the gate is not met

Leave unperformed platform checks explicitly pending.

Final project

Deliver the app files, service worker, cache inventory, lifecycle notes and actual local offline test log. Demonstrate cleanup of only the project’s own cache during a version change.

Critical condition

Worker scope and cache cleanup stay inside the project, and unperformed offline tests are not claimed.

CriterionPointsEvidence
Evidence and correctness30Calculations, source use and results match the supplied case; limitations are honest.
Required artifacts30All five stage outputs and the capstone handoff are present and inspectable.
Reasoning and decisions20Choices, assumptions, alternatives and the case-specific critical condition are explained.
Reproducibility10A reviewer can follow the stated steps and distinguish expected from observed results.
Clear communication10Labels, units, structure and evidence references make the work easy to review.

Score at least 80/100, supply every required artifact, and satisfy the path-specific critical condition. Rework missing evidence before marking complete.

Worked reference

Only the three public shell resources are precached. After a successful online installation and controlled reload, the cached lesson should be available offline. That expected behavior must be confirmed in a real browser; it is not implied merely by the presence of sw.js.

Boundaries

This is a local static offline prototype, not a production PWA, cross-device sync service or universal installability guarantee.