The iOS app opens offline: the page is kept however it was loaded (#506)
The phone in airplane mode opened to "Cannot reach ipodderx.sdf1.net". The service worker kept the page only when a navigation passed through it, and the app's own load from Swift may not, so it had no page to answer with. The page now asks the worker to keep / on every load, and the app, when a load fails for want of a connection, tries once more from the web view's cache (returnCacheDataDontLoad) before the alert. The Swift is not compiled here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
// it was.
|
||||
const worker=('serviceWorker' in navigator) ? navigator.serviceWorker : null;
|
||||
worker?.register('/sw.js').catch(()=>{});
|
||||
// The worker keeps this page for opening offline, however it was loaded (#506).
|
||||
void worker?.ready.then(r=>r.active?.postMessage({keepPage:true}));
|
||||
const toWorker=(msg: object)=>worker?.controller?.postMessage(msg);
|
||||
/// What waited for the connection goes now: on its return, and when the live stream comes back.
|
||||
function flushOutbox(){ toWorker({flush:true}); }
|
||||
|
||||
Reference in New Issue
Block a user