Wow, this approach looks like a game-changer! Bypassing the OnDownloadNeeded listener completely would solve so many of my permission headaches on Android 11+.
I am definitely going to try this 'Base64 to WebViewString' method. I just have two questions before I rewrite my code:
String Limit: Since this is a File Compressor app, the Base64 strings might be quite large (e.g., 5MB to 10MB). Have you tested if window.AppInventor.setWebViewString has a character limit or if it causes the app to freeze with large data?
The Async Logic: You mentioned it needs to be an async function to return the promise correctly. Could you share a small snippet of how you structure that async/await wrapper around the FileReader?
Thanks a lot for this suggestion, it really helps!
Technically, I believe it should be able to handle 5-10mb string sizes (you understand that base64 is generally @ 33% bigger than the original file). In practical terms you may hit a wall. Maybe you are just not compressing enough!!
In your html/javascript you are creating the blob, so you already have the blob, therefore there is no need to "fetch" the blob from a blobUrl, your code will/should work OK to convert the blob to a base64, and you can then create the blobUrl for file download purposes.
If you only want to return the base64 to the app then as I showed, use the webviewstring to pass the base64 string to the app. You can programmatically remove the datauri section like so:
How do i enable dark mode for sites like google or duck duck go, i have a theme in my app that i want to sync with all websites, I tried the setdarkmode but it doesnt work
Long Answer:
Click on the search icon
Enter search query (blob or download blob in this case)
Select in this topic option
Now you have to read last few answers
Is there a way I can download only the download helper? I want to use customwebview and download helper, but not browser prompts. I am trying to make a project using only these 2 extensions. Bare bones, nothing un-needed.