Removing old site Service Worker

Hey people, I have an old website that had a service worker on it. Now I migrated the domain to point to a Wix Store. The problem is that, people that already accessed the old website will still see it because of the SW…

I’m trying to unregister it by using Corvid but it does not allow me to access window.navigator

Does anyone have a possible solution for it?

If you want to do something like ‘window.navigator’ which you can’t use with Wix as it uses javascript and you can’t get access to the DOM.
https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator
https://www.w3schools.com/js/js_window_navigator.asp
https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
https://developers.google.com/web/ilt/pwa/introduction-to-service-worker

You can possibly look at using userAgent function from Wix Router.
https://www.wix.com/corvid/reference/wix-router.WixRouterRequest.html#userAgent

You can also look at other online pages to help too.
https://stackoverflow.com/questions/33704791/how-do-i-uninstall-a-service-worker
https://love2dev.com/blog/how-to-uninstall-a-service-worker/
https://github.com/GoogleChromeLabs/sw-precache/issues/340
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/unregister

Or you can come up with your own coded workaround for this with the use of Wix HTTP Functions or Wix Fetch.
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api

Although, if you read previous posts about this, you might find that you can’t do it through Wix and you will need to go back to before Wix time.
https://www.wix.com/corvid/forum/community-discussion/how-to-install-service-worker-from-subscribers-com
https://www.wix.com/corvid/forum/community-discussion/how-to-add-service-worker-file-to-root-directory
https://www.wix.com/corvid/forum/community-discussion/need-to-install-a-service-worker-in-the-root-dierctory