- From: dfabulich <notifications@github.com>
- Date: Wed, 29 Nov 2017 21:27:42 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 30 November 2017 05:28:03 UTC
In the meantime, I recommend developers use code like this during the `fetch` event in `navigate` mode, returning a blank Response with a `Refresh: 0` header. ```js addEventListener('fetch', event => { event.respondWith((async () => { if (event.request.mode === "navigate" && event.request.method === "GET" && registration.waiting && (await clients.matchAll()).length < 2 ) { registration.waiting.postMessage('skipWaiting'); return new Response("", {headers: {"Refresh": "0"}}); } return await caches.match(event.request) || fetch(event.request); })()); }); ``` When doing an ordinary navigation while a `v2` Service Worker is waiting, the last/only `v1` tab will briefly show a blank page, then auto-refresh into a `v2` tab. If the page response happens to use `Content-Disposition`, the download will initiate, but the tab will turn blank and stay blank. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1238#issuecomment-348086446
Received on Thursday, 30 November 2017 05:28:03 UTC