pwa

Angular 6 PWA with Node not working

試著忘記壹切 提交于 2019-12-02 07:19:44
I have a Angular 6 app that works and registers the SW when served with http-server --port 8080 command as you can see here: But when I serve the files from my Node / Express application that they are meant to be served. The service worker won't register, tried running the app from localhost and also from Heroku but it's the same. Application works otherwise. Any idea what can cause this? I think this issue is to do with the path that @angular/cli uses when registering the service worker, I have found registering the service worker in main.ts to be more reliable: platformBrowserDynamic()

Angular Service Worker SwUpdate.available not triggered

痞子三分冷 提交于 2019-11-27 15:49:37
问题 I'm having a hard time integrating angulars service worker into my application. I followed the guide and it works so far. I can create a shortcut on my homescreen and launch into my app. The problem is that my app somehow doesn't update. If I change the name of a button, build the app and put it onto my server the app still shows the old version until I hit F5 (restarting the app doesn't help either). I tried to put the following code into my ngOnInot of my app but it didn't help ngOnInit() {

Can service workers cache POST requests?

有些话、适合烂在心里 提交于 2019-11-27 12:09:13
I tried to cache a POST request in a service worker on fetch event. I used cache.put(event.request, response) , but the returned promise was rejected with TypeError: Invalid request method POST. . When I tried to hit the same POST API, caches.match(event.request) was giving me undefined. But when I did the same for GET methods, it worked: caches.match(event.request) for a GET request was giving me a response. Can service workers cache POST requests? In case they can't, what approach can we use to make apps truly offline? Marco You can't cache POST requests using the Cache API. See https://w3c

Can service workers cache POST requests?

你离开我真会死。 提交于 2019-11-26 15:54:32
问题 I tried to cache a POST request in a service worker on fetch event. I used cache.put(event.request, response) , but the returned promise was rejected with TypeError: Invalid request method POST. . When I tried to hit the same POST API, caches.match(event.request) was giving me undefined. But when I did the same for GET methods, it worked: caches.match(event.request) for a GET request was giving me a response. Can service workers cache POST requests? In case they can't, what approach can we