2

As you can see in the image below, my service worker is both active and the file I am fetching is within the scope of the service worker, but the fetch event is still not being fired.

console & <code>sw.js</code> source Are there other required conditions for fetch to be intercepted by the service worker?

Lucas Araujo
  • 1,648
  • 16
  • 25
garviand
  • 397
  • 3
  • 7
  • 1
    It seems that the scope of the service worker relative to the scope of the files it is accessing is irrelevant. However, the scope of the service worker relative to the scope of the page that has accessed it (in the browser) determines if the fetch event can be intercepted. Please let me know if this is true. – garviand Feb 14 '18 at 16:51
  • 1
    This happened to me and I had to move the ServiceWorker to the root in order to fix the scope – Albert Vila Calvo Sep 03 '18 at 12:08
  • possible related: https://stackoverflow.com/questions/54027096/serviceworker-handling-fetch-events-to-urls-outside-scope – n0099 Dec 15 '22 at 18:32

0 Answers0