Content continuity
Core prose, diagrams, citations, and navigation must render without remote fonts, scripts, images, or APIs.
Cross-browser architecture report
A researched guide to offline-first pages on Safari for iPhone, Android browsers, and desktop. It distinguishes portable documents from installed web applications, then defines a durable architecture for both.
01 · Orientation
“Works without service” can mean surviving a temporary network loss, launching after a reboot, retaining edits for months, or remaining accessible after the origin disappears. These are different guarantees.
A browser PWA is a local replica whose storage can be removed. A self-contained HTML file is a portable archive with weaker application semantics. Durable delivery needs both.
Core prose, diagrams, citations, and navigation must render without remote fonts, scripts, images, or APIs.
An installed version must precache its complete application shell and verify that the offline entry point exists.
User-created notes and pending actions need durable local storage, export, conflict handling, and recovery.
02 · Survival model
Offline architecture should be selected against explicit failure conditions. “Airplane Mode after first use” is much easier than “first-ever launch with no network” or “retain critical records after browser eviction.”
| Failure condition | Hosted PWA | Downloaded HTML | Native web wrapper |
|---|---|---|---|
| Network disappears after initial load | Strong | Strong | Strong |
| Origin is temporarily unavailable | Strong if fully cached | Strong | Strong |
| First launch occurs offline | Fails unless preinstalled and provisioned | Works if file already exists | Works when bundled |
| Browser evicts site data | Can lose cache and database | Usually unaffected | Usually unaffected |
| User clears browser data | Local replica removed | Usually unaffected | Application-dependent |
| Controlled updates | Strong | Manual replacement | Strong |
| Long-term archival | Medium | Strong | Medium |
| Reliable background execution | Browser-specific | Not applicable | Strongest |
The correct mental model is a layered guarantee. The document layer preserves meaning. The PWA layer preserves interaction. A native layer is reserved for operational guarantees the browser cannot make.
03 · Safari on iPhone
Modern Safari supports service workers, Cache Storage, IndexedDB, OPFS, persistent-storage requests, and Home Screen web apps. The main risks are storage lifecycle, installation sequencing, and absent background-sync primitives.
On iOS 26, websites added to the Home Screen open as web apps by default. This improves launch behavior, but installation alone does not create an offline package. A service worker and completed cache population are still required.S1
WebKit’s modern policy allows browser origins to use a substantial fraction of disk capacity, subject to per-origin and aggregate limits. These are ceilings, not guarantees; every write must handle quota failure.S2S5
Safari can copy cookies into a newly installed Home Screen app, but it does not copy IndexedDB, Cache Storage, or local storage. The installed app must provision its own offline package after installation.S3
Browser storage is best-effort unless persistence is granted. WebKit evaluates navigator.storage.persist() through heuristics. Home Screen usage improves the durability posture, and Home Screen app domains are exempt from WebKit’s ITP seven-day script-storage cap.S2S4
Background Sync and Periodic Background Sync are not cross-browser baseline features. Safari-compatible designs must replay a local outbox during foreground opportunities rather than depend on a worker running after the app closes.S7S8
Treat private sessions as ephemeral. Stored state is not a durable offline repository and can disappear when the private session ends.S4
Add the site to the Home Screen before relying on installed-app storage.
The Home Screen app is a distinct storage context from Safari.
Download every required asset, validate package completeness, and show “Available offline.”
Close the app, disable connectivity, reopen from the Home Screen, and exercise critical flows.
04 · Browser comparison
Service workers, Cache Storage, IndexedDB, and foreground retry form the dependable cross-browser core. Chromium-only background capabilities should improve freshness, never determine correctness.
| Capability | Safari / iPhone | Chrome / Android | Firefox / Android | Desktop browsers |
|---|---|---|---|---|
| Service worker + Cache API | Supported | Supported | Supported | Supported across majors |
| IndexedDB | Supported | Supported | Supported | Supported |
| Origin Private File System | Supported | Supported | Supported in current engines | Broad modern support |
| Persistent-storage request | Heuristic grant | Heuristic grant | Browser policy / permission | Implementation-specific |
| One-off Background Sync | Do not rely on it | Available in Chromium | Do not rely on it | Mostly Chromium |
| Periodic Background Sync | Unavailable | Experimental and heuristic | Unavailable | Chromium-specific |
| Large background downloads | No portable guarantee | Background Fetch in Chromium | No portable guarantee | Limited availability |
| Install as application | Home Screen web app | Strong PWA install flow | Install flow available | Strongest in Chromium and Safari |
05 · Distribution models
The distribution model determines first-offline launch, update control, storage semantics, and archival strength. No single model dominates every requirement.
A single file contains its HTML, CSS, JavaScript, SVG, content, and essential media. It can be saved, transferred, and opened without the original server.
file: is not a portable service-worker deployment.A hosted application uses a manifest, service worker, versioned caches, and a structured local database. It is installed and then explicitly provisioned for offline use.
A Swift, Capacitor, or Android wrapper bundles the HTML application and uses native storage, distribution, lifecycle, and background facilities where needed.
06 · Recommended architecture
Maintain content separately from presentation. Render the same structured report into a single-file edition and an installable PWA edition, avoiding divergent documents.
Every essential claim, diagram, table, and citation is present in the HTML and does not require a network request to be understood.
The PWA advertises offline readiness only after all required resources are cached and validated against a versioned package manifest.
Valuable user state can be exported. Cache loss, quota rejection, and failed upgrades have explicit recovery paths.
offline-research/
├── offline-first-research.html # portable, self-contained edition
└── web/
├── index.html # installed application shell
├── manifest.webmanifest
├── sw.js
├── package-manifest.json # asset URLs, versions, hashes
├── assets/
│ ├── application.css
│ ├── application.js
│ ├── icons/
│ └── diagrams/
└── content/
├── report-v1.json
└── search-v1.json
07 · Implementation
Service-worker registration is not proof of offline readiness. The application must download, validate, record, and expose the exact state of its offline package.
const CACHE_VERSION = "offline-report-v1";
const REQUIRED_ASSETS = [
"/",
"/index.html",
"/assets/application.css",
"/assets/application.js",
"/content/report-v1.json",
"/content/search-v1.json",
"/icons/icon-192.png",
"/icons/icon-512.png"
];
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE_VERSION)
.then((cache) => cache.addAll(REQUIRED_ASSETS))
);
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(
keys
.filter((key) => key !== CACHE_VERSION)
.map((key) => caches.delete(key))
)
)
);
});
self.addEventListener("fetch", (event) => {
const request = event.request;
if (request.mode === "navigate") {
event.respondWith(
caches.match("/index.html")
.then((cached) => cached ?? fetch(request))
);
return;
}
event.respondWith(
caches.match(request)
.then((cached) => cached ?? fetch(request))
);
});
Unconditional skipWaiting() can combine an old page, a new worker, a changed content schema, and an old database. That mixed-version state is difficult to reproduce and recover.
Install and validate the next package first. Notify the user that an update is ready. Reload into the new page-worker-content set as one controlled transition.
A package is either complete or unavailable. Record the expected version, required URLs, optional hashes, validation result, and activation status.
A partially downloaded report should not display a misleading “Available offline” badge.
async function provisionOfflinePackage(
version: string,
requiredAssets: readonly string[]
): Promise<{
persistent: boolean;
usage?: number;
quota?: number;
}> {
const persistent =
"storage" in navigator &&
"persist" in navigator.storage
? await navigator.storage.persist()
: false;
const cache = await caches.open(version);
await cache.addAll(requiredAssets);
const missing: string[] = [];
for (const url of requiredAssets) {
if (!(await cache.match(url))) {
missing.push(url);
}
}
if (missing.length > 0) {
await caches.delete(version);
throw new Error(
`Offline package incomplete: ${missing.join(", ")}`
);
}
const estimate = await navigator.storage?.estimate();
return {
persistent,
usage: estimate?.usage,
quota: estimate?.quota
};
}
| Mechanism | Use it for | Do not use it as |
|---|---|---|
| Cache Storage | Application shell, HTML responses, images, fonts, immutable content packages | A queryable domain database |
| IndexedDB | Notes, outbox, content index, package records, structured local state | A simple synchronous preference store |
| OPFS | Large binaries, SQLite/WASM files, generated archives, local processing | A user-visible file system without export |
| localStorage | Small, non-critical display preferences | Large data, transactional data, or important records |
| Cookies | Session hints and HTTP authentication context | Offline content or an authoritative data store |
08 · Security and synchronization
Offline access changes the enforcement boundary. Authentication expiry, logout, device sharing, and cached sensitive content require explicit policy rather than incidental browser behavior.
interface PendingOperation {
id: string; // idempotency key
entityId: string;
baseVersion: string; // conflict detection
operation: "create" | "update" | "delete";
payload: unknown;
createdAt: string;
attempts: number;
state:
| "pending"
| "sending"
| "conflict"
| "acknowledged";
}
09 · Validation
DevTools simulation is useful but incomplete. Validation must cover physical network loss, lifecycle termination, cache corruption, quota pressure, version transitions, and user recovery.
QuotaExceededError during package write.10 · Artifact standard
This standard is appropriate for research reports, explainers, documentation, travel plans, reference guides, and presentations that may be used in low-connectivity environments.
Single-file HTML. No essential external dependencies. Semantic HTML. Inline SVG. Print support. Core readability without JavaScript.
HTTPS origin. Manifest. Versioned service worker. Explicit package provisioning. Storage diagnostics. Atomic updates.
Persistent-storage request. Export. Recovery. Offline authorization policy. Foreground sync. Real-device validation.
| Requirement | Portable HTML | PWA edition | Validation |
|---|---|---|---|
| No essential external dependencies | Required | Required for cached core | Block network requests and review |
| First launch with no service | Required after file transfer | Required after provisioning | Cold launch in Airplane Mode |
| Visible readiness state | Artifact metadata | Verified offline badge | Delete one asset and confirm failure |
| Version and provenance | Embedded | Embedded and locally recorded | Inspect document metadata and package record |
| Responsive containment | Required | Required | No page-level horizontal scroll at 320px |
| Recovery from local-data loss | Redownload file | Reprovision and restore export | Clear site data and recover |
Use the browser-only dual-output architecture for documents and non-critical applications. Add a native wrapper or managed local database when offline availability, unsynchronized records, or security controls are operationally mandatory.
11 · Evidence
Sources prioritize WebKit, Mozilla/MDN, and Chrome platform documentation. Browser behavior remains version-sensitive; revalidate before adopting the report as a production compatibility contract.
This report separates observed platform behavior from architectural recommendations. Official engine and platform documentation was preferred. Cross-browser recommendations were constrained to primitives broadly implemented by major browser engines. Chromium-only capabilities were classified as progressive enhancements.
Generated July 21, 2026. The document is intentionally self-contained and uses no remote fonts, scripts, images, or stylesheets.