self.addEventListener("fetch", (event) => {
if (event.request.mode === "navigate" && event.request.isReloadNavigation) {
event.respondWith(
fetch(event.request).catch(() => caches.match(event.request)),
);
} else {
event.respondWith(
caches
.match(event.request)
.then((cached) => cached || fetch(event.request)),
);
}
});Request: isReloadNavigation property / notebook
Request: isReloadNavigation property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.