react-native-webview: Download of a blob url doesn't work on Android
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

AndroidManifest.xml

Environment:
- react-native version: 0.67.4
- react-native-webview version: 11.17.2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 15
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 🔥
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.
Did you solve it, @LuanEdCosta ?