jimmywarting / StreamSaver.js

StreamSaver writes stream to the filesystem directly asynchronous
https://jimmywarting.github.io/StreamSaver.js/example.html
MIT License
3.95k stars 413 forks source link

Scope of the service worker #299

Closed ToniOs1996 closed 1 year ago

ToniOs1996 commented 1 year ago

I am facing currently this issue: "The path of the provided scope ... is not under the max scope allowed ... . Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope." Is there a way to inject the Service-Worker-Allowed header without changing the service worker code?

Any idea? Thank you

jimmywarting commented 1 year ago

seems like browser are taking extra measure to prevent 3th party origin to download stuff from service worker coming from another domain... firefox may be even more restrict nowdays...

guess the best corse of action is to provide a guide of how to download stuff using self hosted service worker... I have found one potential iframe sandbox flag that might help...

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox

  • allow-downloads-without-user-activation Experimental: Allows for downloads to occur without a gesture from the user.
  • allow-downloads: Allows for downloads to occur with a gesture from the user.
ToniOs1996 commented 1 year ago

Hi, thanks for the answer. I solved the issue by setting the Service-Worker-Allowed header. As well it was required to self host the MITM and to change the scope of the service worker.