How to pass a Blob object from javascript to Android?

android, blob, html, javascript, webview

Solution

I found a solution by converting the blob to Base64 String

 var reader = new window.FileReader();
 reader.readAsDataURL(blob); 
 reader.onloadend = function() {
                var base64data = reader.result;                
                // send base64data string to android as a method param
  }

Problem

I have a Blob object inside my WebView, how can I pass it to Android? I want to save it to local file on device. I been trying to use: ``` var url = webkitURL.createObjectURL(myBlob); ``` But I wasn't been able to download it to device.

Original source

Related problems