Auto-Refresh page if offline...

This commit is contained in:
Crimekillz 2024-04-06 03:23:31 +02:00
parent e0f84d1ce6
commit 2f27250bc8

View File

@ -28,7 +28,7 @@ globalThis.addEventListener("activate", (ev) => {
}); });
function offlineContentHTML(): string { function offlineContentHTML(): string {
return `<!doctype html>Offline. Service Worker @${_VERSION_} <button onclick="location.reload()">reload</button>`; return `<!doctype html>TrashPoss @${_VERSION_} is currently offline. Retrying in 5 seconds... <button onclick="location.reload()">Reload manually</button>`;
} }
globalThis.addEventListener("fetch", (ev) => { globalThis.addEventListener("fetch", (ev) => {
@ -48,6 +48,7 @@ globalThis.addEventListener("fetch", (ev) => {
status: 200, status: 200,
headers: { headers: {
"content-type": "text/html", "content-type": "text/html",
"Refresh": "5",
}, },
}); });
}), }),