-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current Opera + HTTP = download popup blocked #95
Comments
I think this might be solved if we use the same popup to start the service worker and to start the download. Doing that would also reduce the number of popups that need to be opened for the download to start, both on HTTP and on background pages on Firefox. |
uh? had to read that 2,3 times... if the mitm.html opens just fine it should work as expected? in the current version the download happens using a hidden iframe on the main thread so there shouldn't be any popup blocker? Will try to reproduce quickly, Maybe work on a fix tomorrow edit apparently the download happen using popup also 😕 |
The download happens on a popup because the top page is insecure. Chrome doesn't allow a request from the If you try to start the download from inside the I think this is a good opportunity to start reusing the same popup, since there is another situation where it would be useful (Web Extension's background page on Firefox). |
The best solution is to re-use the popup. currently i see two solutions
|
I don't know which one is best, but we should see if they interfere with the immortal Service Worker bug on Chrome and Opera. If there is a way to use the same popup and still have an immortal Service Worker, that would be best. :) |
The best thing maybe would just be to embrace the should allow to go idle thingy and transfer the readableStream directly to the download so no postMessage & pinging back and forth has to happen. Would maybe also like to see the I have tried a prof-of-concept version by doing |
Sure, but for that we would have to have a way to start the Service Worker again when needed. On secure contexts we can do that from the iframe, so it shouldn't matter much, but on HTTP we would need to open another popup just to start the Service Worker. Maybe we can keep a message port open until all the streams are closed, at which point we close the port, stop keeping the SW alive and require another
Sounds fine. However, it would be very bad if we were to close this popup with a 10s timeout. That would be 10 seconds of a blank window open. |
Found out that you can't close the popup or iframe directly after you send the "download started" postMessage. What do you think is the best solution for that?
even if you wait for a few bytes or for it to finish you still have to wait until the user hits the save button. think we should just leave the download iframe stay open and never close it (what harm dose a hidden blank iframe do? it doesn't run any js or have any DOM) but what should we do about the popup? |
Well, shit. I hadn't thought about that use case. I guess one possibility would be to figure out the conditions for triggering the download on each browser and only open the popup/start the download when those conditions are met. (e.g.: lets imagine Chrome only does it after 1024 bytes written or the stream is closed, then we wait for one of those conditions to happen and then start the download - by the way, this is made up, I don't actually know if those are Chrome's conditions). I think anything else would either modify the download's content or leave a popup open for (possibly) a long time. Another idea would be to try inserting a lot of filler headers on the response to try and trigger the download from those bytes instead of the download body's bytes. If this works the download would always be instantaneous, no matter the size or the time it takes to write the first byte. |
if we don't trigger the download right away (on user interaction) then we are back on popup being blocked. We can't just close the popup after 1024 bytes has been written. We must also wait for the user to pick a path, set filename and hit save. (which we can't detect) one possible solution is to
|
found the best way is to redirect the main window, but only if the page is insecure and needs popups to the download url, in other cases we use hidden iframes. |
Would it be better to use |
Well, we can always just buffer the first bytes without opening the I don't know if the downloads API will work with the SW interception. We can test it. Redirecting the main window will still close open connections, right? If it is possible to avoid it, I think we should. What happens when we close the popup before the user selects the destination folder? On Firefox the download proceeds as it should, but I think my Chrome was always configured to save on the Downloads folder by default. |
If we can force the download to start without writing any byte by messing with the headers, that would be ideal. |
I think i may have found a hack do not having to open any further popups at all after the service worker have been installed 😁 🤪 Edit Damm it didn't work, but god what a awful hack that would have been. Don't think you even would want to hear about it, haha - this hole expose secureOnly specification is a pain in the butt |
It seems the current version of Opera blocks the popup with the download link, even if StreamSaver.js is called from an user interaction.
The
mitm.html
popup is opened normally, but when it is time to open the popup with the download link it is blocked.This does not happen on version 40 of the Opera browser, where the download is started as it should.
The text was updated successfully, but these errors were encountered: