service-worker

start_url does not respond with a 200 when offline: The start_url did respond, but not via a service worker. Lighthouse Audit problem

我的未来我决定 提交于 2021-01-27 15:29:57
问题 I am creating a PWA that works offline with a service worker. Right now it works correctly, but there is a problem in Lighthouse Audit. When I run Lighthouse, in the PWA section I get this problem: start_url does not respond with a 200 when offline The start_url did respond, but not via a service worker. How do I pass that audit, even if there are other audits that say that I have successfully installed a service worker? My website is here: https://nariohtools.com and the service worker is

Are promises lazily evaluated?

吃可爱长大的小学妹 提交于 2021-01-27 12:19:43
问题 Is the code below guaranteed to output HERE ? var p = new Promise(() => console.log("HERE")) (That is, does var p = new Promise(fn) always execute fn if p.then(…) is never called to do something with the result?) More specifically, in the context of service workers, if I call Cache.delete() but never call .then() on the return value (or I throw away the return value), is the cache entry guaranteed to be deleted? 回答1: Yes, it is guaranteed. The specification of Promise has this step which will

How to use process.env in a React service worker

为君一笑 提交于 2021-01-26 05:37:22
问题 I am trying to set-up a Firebase-messaging-sw.js file (for web push notifications). I am wondering if there is a way to avoid exposing my Firebase config data to the public as much as possible - though it might be revealed anyways? (I'm not too sure about the nuances) I've tried following: How can I customize my Service Worker based on environment variables? But the answer's swEnvbuild doesn't seem to be running, as the swenv.js file is not found. I suspect it might need to be set-up

How to use process.env in a React service worker

杀马特。学长 韩版系。学妹 提交于 2021-01-26 05:36:28
问题 I am trying to set-up a Firebase-messaging-sw.js file (for web push notifications). I am wondering if there is a way to avoid exposing my Firebase config data to the public as much as possible - though it might be revealed anyways? (I'm not too sure about the nuances) I've tried following: How can I customize my Service Worker based on environment variables? But the answer's swEnvbuild doesn't seem to be running, as the swenv.js file is not found. I suspect it might need to be set-up

How to slow down a service-worker to simulate 56k or 2G 3G slow connection

ε祈祈猫儿з 提交于 2021-01-20 07:53:25
问题 Here is my use-case : I'me developping Static Site Generator and stuff for them. I would like to host on static pages (like gitlab-pages or github-pages) some demo of my stuff. So I can't use server-side tricks to simulate slow connexion. My demo page should look like this : see my stuff in normal mode see my stuff before optimisation with a simulated 56k connection see my stuff after optimisation with a simulated 56k connection I've not found any service-worker built for this. Any Idea where

503 ok (from serviceWorker)

旧巷老猫 提交于 2021-01-13 04:07:05
问题 I used @angular/service-worker to generate SW for an angular4 web app. after updating the ngsw-manifest.json to handle dynamic request from the server I get "Status Code:503 OK (from ServiceWorker)" when offline (after first loading). Any thoughts? 回答1: your problem is related with [Content Security Policy (CSP)] configuration on your web server or proxy nginx. Due you are connecting properly with nginx, the PWA offline feature is not enabled in your browser. read more on (https://content

If you are using Service Workers do you still need cache-control headers?

荒凉一梦 提交于 2021-01-02 19:29:23
问题 Is there any use-case where the use of cache-control headers should be preferred over Service Workers? Is there any benefit using both of them (apart from the fact the SW are not cross-browser supported) ? 回答1: Absolutely. HTTP cache, which is controlled by HTTP cache headers sits between the network and the service worker. All fetch requests initiated from the service worker still use HTTP cache. Let's say you have a script with long max-age . Most Service Workers repopulate their caches

If you are using Service Workers do you still need cache-control headers?

*爱你&永不变心* 提交于 2021-01-02 19:25:27
问题 Is there any use-case where the use of cache-control headers should be preferred over Service Workers? Is there any benefit using both of them (apart from the fact the SW are not cross-browser supported) ? 回答1: Absolutely. HTTP cache, which is controlled by HTTP cache headers sits between the network and the service worker. All fetch requests initiated from the service worker still use HTTP cache. Let's say you have a script with long max-age . Most Service Workers repopulate their caches

If you are using Service Workers do you still need cache-control headers?

人盡茶涼 提交于 2021-01-02 19:23:29
问题 Is there any use-case where the use of cache-control headers should be preferred over Service Workers? Is there any benefit using both of them (apart from the fact the SW are not cross-browser supported) ? 回答1: Absolutely. HTTP cache, which is controlled by HTTP cache headers sits between the network and the service worker. All fetch requests initiated from the service worker still use HTTP cache. Let's say you have a script with long max-age . Most Service Workers repopulate their caches

If you are using Service Workers do you still need cache-control headers?

白昼怎懂夜的黑 提交于 2021-01-02 19:23:13
问题 Is there any use-case where the use of cache-control headers should be preferred over Service Workers? Is there any benefit using both of them (apart from the fact the SW are not cross-browser supported) ? 回答1: Absolutely. HTTP cache, which is controlled by HTTP cache headers sits between the network and the service worker. All fetch requests initiated from the service worker still use HTTP cache. Let's say you have a script with long max-age . Most Service Workers repopulate their caches