We have an angular 7 app set up with Angular Service Worker (ngsw-worker). We discovered that our index.html
file was cached, which caused our site to not work every time we did a new release (due to the index.html file pointing to the old css
and js
files).
I removed the service worker from our application and re-deployed that, but it seems as though people still have the service worker installed on their browser and the old index.html
is still being cached for them.
What can I do to get the service worker to update and not cache the index.html
? I thought the service worker updated itself after 24 hours. How can I get the index.html
to be removed from the service worker cache for some of our users?
Asked
Active
Viewed 622 times
3

NeNaD
- 18,172
- 8
- 47
- 89

CaptainMorgan
- 1,193
- 2
- 25
- 55
-
you need https://angular.io/api/service-worker/SwUpdate... with more details on https://alligator.io/angular/service-worker-updates/ – Akber Iqbal Jan 21 '19 at 06:23
-
the SwUpdate is checking new service version is available, if yes then download new version but it not refect immediately but it will reflect in next page refresh or reload. – Pankaj Rupapara Sep 24 '19 at 01:46
-
I had the same problem. I posted my answer here how I solved it: https://stackoverflow.com/a/68211878/14389830 – NeNaD Jul 01 '21 at 14:19