Troubleshooting

Service worker is not detected

If you are using Fanplayr's sw-load.js script, you must ensure that this is included on your webpage before Fanplayr's tracking code.

Cannot upload service worker JavaScript file to root

If you are unable to upload the service worker JavaScript file to the root of your server then you may be able to proceed if you can upload it elsewhere with specific headers.

  1. Ensure your server is delivering the service worker file with the following headers:

  2. Content-Type: text/javascript

  3. Service-Worker-Allowed: /

  4. If you are manually registering the service worker (not using our sw-load.js script) then you will need to update your code to force the worker to be loaded at the root scope. For example:

<script>
if ('serviceWorker' in navigator) {
  // Note: Replace PATH_TO_SERVICE_WORKER with correct path on your server.
  navigator.serviceWorker.register('/PATH_TO_SERVICE_WORKER/serviceWorker.js', {
    // Force service worker to load in root scope.
    scope: '/'
  }).then(function() {
    window.fanplayrServiceWorker = true;
  });
}
</script>

Last updated