An unknown error occurred when fetching the script (Service Worker)

前端 未结 5 873
温柔的废话
温柔的废话 2021-02-12 17:28

When going offline, I get the following error by my service worker:

(unknown) #3016 An unknown error occurred when fetching the script

my service w

5条回答
  •  生来不讨喜
    2021-02-12 18:12

    I had exactly the same problem, I spent an hour trying to figure it out and it turned out that I had another tab for the same origin left opened somewhere (so using the same shared Service Worker) that had the "Offline" checkbox left checked and that prevented another tabs from requesting sw.js for some reason.

    It seems that the offline state is leaking from the tab within Service Worker scope while not being properly reflected nor managed by the other tabs than the one that was turned Offline first.

    So make sure you have no other clients running the same Service Worker - you should be able to find them listed in DevTools > Application > Service Workers.

提交回复
热议问题