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
bug: Blob downloads don't work on iOS & Android #5478
Comments
This comment was marked as abuse.
This comment was marked as abuse.
Same issue here |
bump, I'm not sure if the PR for this works entirely but this functionality is necessary and expected out of the box |
In the console on Android I see this error: |
same here |
Also experiencing the same error when attempting to download a file from a data url |
1 year after, and the problem is not solved :( |
Same error on iOS |
Is there any solution? |
Any update on this? |
1 similar comment
Any update on this? |
Please, see #5498 (comment) for the latest info on this. |
Bug Report
Capacitor Version
Platform(s)
Current Behavior
iOS 15>= (tested on few 15.x different versions)
Whenever browser is asked to
navigate
to a URL such asblob:capacitor://localhost/ee26ec26-911c-461e-b01e-dd715c99e54a
something like:is printed out and nothing happens.
iOS 13.2.2, 13.0, 14.0.1 & 14.5 - (safe to assume this for 14.5 =<)
Error is different:
Android
Nothing happens, more investigation is needed to see technical details of the implementation.
Expected Behavior
Allow that blob to be downloaded without errors into a standard download directory (as Safari does).
Maybe, an even better solution would be asking the user where to save it. (optionally)
By RFC these URLs should be handled and downloaded by the browser. More details at: https://w3c.github.io/FileAPI/#url-intro
Code Reproduction
iOS
npx capacitor open ios
, run from thereAlternatively: (with any Capacitor app you might have around)
capacitor.config.json
server.url tohttps://jimmywarting.github.io/StreamSaver.js/examples/saving-multiple-files.html
(example)start
button, and click on it.Android
Same from iOS, however, no error is displayed and the file is not visible anywhere else on the system.
Other Technical Details
iOS
I believe this is not related to any versioning-related problem as it seems iOS 15 significantly improved the support of download/blob on the
WKWebViewDelegate
.With some tweaks on the
WebViewDelegationHandler
, I was able to make it work and download to thedownloads
ordocuments
folder seamlessly.Android
Still, more investigation is needed on the Android side, but RFC described behaviour should also be
Additional Context
By RCF
blob:
URL schema should trigger the download of the URL being provided. I believe this will enhance Capacitor support to already existing apps as developers expect the same behaviour to be followed.Possible fix
Changes on the
WebViewDelegationHandler
like the one below will handle it foriOS > 14.5
, however still unsure where it should be saved as a default and how to allow developers to overwrite this behaviour. Another important factor is the attempt of making it to work with previous iOS versions for sure.Creating a PR soon and linking into this issue. (Changes will be certainly be needed)
Edited to Improve issue with reproducible code, android behaviour and other small improvements
The text was updated successfully, but these errors were encountered: