Skip to content Skip to sidebar Skip to footer

Unable To Post Message To Service Worker Because Controller Value Is Null

I am trying to make a website available offline with the help of service workers to cache the files needed by the page. I am trying to give the user control over which images he wi

Solution 1:

The problem is that your service worker is registered, but it isn't active and it isn't controlling your page yet.

If you want your service worker to become active, you can call the function skipWaiting in the install event handler.

If you want your service worker to control the page as soon as it becomes active, you can use the Clients.claim function in the activate event handler.

You can see an example in the ServiceWorker Cookbook Immediate Claim recipe.

Post a Comment for "Unable To Post Message To Service Worker Because Controller Value Is Null"