5 ms·
Something that has tripped me up a bit with service workers is this: I can use the service worker to cache all the things, and I can embed their hashes in the
by pjungwir 9y ago
Something that has tripped me up a bit with service workers is this:
I can use the service worker to cache all the things, and I can embed their hashes in the service worker so it knows when to refetch code that has changed, but how do I tell browsers to refetch the service worker script itself (to get the latest hashes)? I've read some people suggesting a no-cache header on just that file, although I see that isn't used here, and it seems to defeat the purpose somewhat. How do other people handle that?
EDIT: At least I'm not the only one: https://github.com/w3c/ServiceWorker/issues/893 https://github.com/w3c/ServiceWorker/issues/893
- detaro 9y agoBrowsers should do that automatically (I seem to remember something like every 24 hours?)
- dracos 9y agoYes, service workers would previously cap caching to 24 hours, see e.g. https://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours https://stackoverflow.com/questions/38843970/service-worker-... but as per the ticket mentioned there – https://github.com/w3c/ServiceWorker/issues/893 https://github.com/w3c/ServiceWorker/issues/893 – they are moving to default no-cache, opt-in caching.