jimmywarting / StreamSaver.js

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

File cannot be loaded with unsecured connection, when serviceWorker does not exist #328

Open alex327512 opened 1 year ago

alex327512 commented 1 year ago

Hi everyone,

I found a case when the file cannot be loaded. It happens when the connection is unsecured (local environment, but it's not localhost). In this case popup just opens once.

Removing isSecureContext in the condition below helped, but it caused the error (The file at link was loaded over an insecure connection. This file should be served over HTTPS.) if (isSecureContext && !('serviceWorker' in navigator))

Seems like it's not a good solution as well as forcing opening Iframe instead of popup. Are there any other possible solutions?

Many thanks!

daolanfler commented 2 months ago

I encounter this problem too, I guess it just doesn't work when your connection is not over https (except localhost) , as both popup and iframe approach need serviceWorker to hijack request.