Need your help please. I want to use the web starter kit on a own build php mvc framework. A part of the web starter kit is the use of a service worker.
In my root folder (called public in my case) i have the service worker file and i register it like the reconommend why like this:
if ('serviceWorker' in navigator &&
(window.location.protocol === 'https:' || isLocalhost)) {
navigator.serviceWorker.register('service-worker.js')
.then(function(registration) {
....
If i try to call the root (index.php) page it works well. But if i try to call any route, the service worker will be called twice and one gives me an error and the second works fine. I found out, that first try with the thrown error just add the service-worker.js on my controller path.
For example, if I try to open mydomain/controller i get an error, that the mydomain/controller/service-worker.js could not found. Sure, there inst any.
Have one of you an idea, how to set that the service-worker will be called only in the root??
Hope, you can help and thank you very much