Disable Service Worker

0 favourites
  • 5 posts
  • My client needs to have the newest version always when player play the game, but with the current Service Worker, it seems it gave the old version first before it gave the new version after a few minutes delay, and then refresh the page.

    Can I disable the Service Worker, so no data is saved offline? I tried deleting the sw.js and offline.json, but it still gave me the old version, eventhough I already uploaded the new version

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'd say it would be better to leave it in and handle updates in your events as described in this tutorial. You can detect when an update is available and automatically reload to always be on the latest version. So you shouldn't need to remove the service worker to do that.

    Deleting sw.js and offline.json will disable the service worker, at the cost of removing offline support. It won't remove any service worker that's already installed for an uploaded page though. You'll have to clear your browser cache to remove it.

  • Hi Ashley, thanks for the reply, I tried clearing my cache, deleting the sw.js and offline.json uploaded it, then upload a new version, it's still not updating to the new version, I thought it would disable the service worker.

    I know Service Worker suppose to be the better solution, but some of my clients could be stubborn, and wanted the solution that already working for them for years, I wish there are ways to easily disable to service worker and not generating error in console.

  • Test with a private/incognito browsing window to see what a new visitor will get.

  • Hi Ashley,

    tried your method, by using the tutorial, at first I thought it was updating correctly, because all the texts are updated, but when I changed the images, some of it did not change, I was confused and thought I made a mistake, tried to clear the cache, and then I saw the changes in the images, so some of the changes or not being updated

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)