I have added a service worker to my page with the code below. It works well once the page has been reloaded and the worker already installed. But does not seem to catch any
Solution: Adding the following to worker.js;
self.addEventListener('activate', function (event)
{
event.waitUntil(self.clients.claim());
});
Service workers don’t immediately “claim” the sessions that load them, meaning that until your user refreshes the page your service worker will be inactive.
The reason for this is consistency, given that you might otherwise end up with half of your webpage’s assets cached and half uncached if a service worker were to come alive partway through your webpage’s initialization. If you don’t need this safeguard, you can call clients.claim and force your service worker to begin receiving events
Read more @ service-workers