In React Native, the WebView component does not support direct download of Blob URL content. The WebView is mainly designed for rendering web content and does not provide built-in functionality for handling downloads.

To enable downloading of Blob URL content in a React Native app, you'll need to implement a custom solution using the WebView's onMessage prop and a combination of web and native code. Here's a general outline of how you can achieve this:

  1. Web (JavaScript) Part: In the WebView, create a download link using an anchor tag (<a>) and set its href attribute to the Blob URL you want to download. When the user clicks on the link, use the WebView's postMessage method to send a message to the React Native side indicating that the download should start.

    <WebView source={{ uri: 'your_webpage_with_blob_url' }} onMessage={(event) => handleDownload(} />
    function handleDownload(data) { if (data === 'startDownload') { const blobUrl = 'your_blob_url'; const downloadLink = document.createElement('a'); downloadLink.href = blobUrl; = 'downloaded_file_name';; } }
  2. React Native Part: In your React Native code, handle the message sent from the WebView and trigger the download process. You can use the react-native-fetch-blob or rn-fetch-blob library to download the Blob URL content and save it locally on the device.

    import { WebView } from 'react-native-webview'; import RNFetchBlob from 'rn-fetch-blob'; function MyWebView() { function onMessage(event) { if ( === 'startDownload') { downloadFile(); } } async function downloadFile() { const blobUrl = 'your_blob_url'; const response = await RNFetchBlob.config({ fileCache: true, }).fetch('GET', blobUrl); const savedPath = response.path(); // Use the savedPath for further processing or display a success message to the user } return ( <WebView source={{ uri: 'your_webpage_with_blob_url' }} onMessage={onMessage} /> ); }

    Note: Make sure to install and link the rn-fetch-blob or react-native-fetch-blob library in your React Native project before using it.

With this approach, when the user clicks the download link in the WebView, a message will be sent to the React Native side. React Native will then initiate the download process using the Blob URL and save the downloaded content locally on the device.

Have questions or queries?
Get in Touch