Skip to content
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

Download of a blob url doesn't work on Android #2526

Closed
LuanEdCosta opened this issue Jun 6, 2022 · 15 comments
Closed

Download of a blob url doesn't work on Android #2526

LuanEdCosta opened this issue Jun 6, 2022 · 15 comments

Comments

@LuanEdCosta
Copy link

Bug description:
I'm generating a blob URL of an audio and putting it into a link tag <a> with the download attr. It works well on the browser, but when I click the link on the React Native Webview nothing happens (no errors).

I thought that it was a permission problem, so I added the WRITE_EXTERNAL_STORAGE to AndroidManifest and requested the permission when the app starts, but it didn't work.

To Reproduce:

// Create a blob URL and pass it to a link tag
// Try to download the audio on the Webview
const blob = new Blob([], { type: 'audio/webm' })
const url = URL.createObjectURL(blob)

<a href={url} download="audio.mp3">Click to Download</a>

Expected behavior:
The audio must be downloaded to the user's phone.

Screenshots/Videos:
App.tsx
image

AndroidManifest.xml
image

Environment:

  • react-native version: 0.67.4
  • react-native-webview version: 11.17.2
@github-actions
Copy link

github-actions bot commented Aug 6, 2022

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@medeirosrafael
Copy link

Did you solve it, @LuanEdCosta ?

@LuciKritZ
Copy link

Did you solve it, @LuanEdCosta ?

+1

@LuanEdCosta
Copy link
Author

No, I didn't find a solution. But I also haven't tried it with the latest version of react-native and react-native-webview yet.

@xsorren
Copy link

xsorren commented Nov 7, 2022

+1 pls helppp

@wahidshadab
Copy link

+1

3 similar comments
@farellsujanto
Copy link

+1

@anazaim77
Copy link

+1

@wahidshadab
Copy link

+1

@MuhammadRafeh
Copy link

Any solution?

@devmuhnnad
Copy link

I face the same issue

@devmuhnnad
Copy link

I have spent hours to find a solution, it turned out that react native doesn't support such a feature 😢

Finally, I had to use native Android with Kotlin, using webChromeClient library,
it worked like magic 🌟 it provides many features to have almost full control over the WebView,
I wrote an implementation to support blob downloading, if someone interested, I could upload the project for you.

@gabrielsme
Copy link

I have spent hours to find a solution, it turned out that react native doesn't support such a feature 😢

Finally, I had to use native Android with Kotlin, using webChromeClient library, it worked like magic 🌟 it provides many features to have almost full control over the WebView, I wrote an implementation to support blob downloading, if someone interested, I could upload the project for you.

I'm interested. Thanks

@devmuhnnad
Copy link

GOOD NEWS!

I am working on implementing this feature, so React-native-webview will support Blob download 🔥

The PR is coming in few days, stay around 🔥

@raviraj-tudip
Copy link

Hi All,

I'm encountering the same issue—I'm unable to download a PDF associated with a blob URL. This problem has been open for quite long time, and we haven't found a solution yet. Could someone please offer assistance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

12 participants