Supporting blob file download in Android Webview

How to download blob type files in android webview

In the android webview, if you try to download a file from blob url, for example, pdf file, the webview will crash with a log “Download manager can download only HTTP and HTTPS links”. This is because downloading blob files are not supported in android webview out of the box. We need additional code to support this function

What is a blob URL?

Blob url looks like this “blob:http://”. This is something that is created inside the browser not from server. So to support this blob file function in android webview, we need set up a few things

  • A javascript interface
  • Javascript codes
  • File download function inside the interface
  • A comparison code to check whether the download url is blob or normal url

This blob file download Support function is currently available in our Android advanced plus webview template. You can find the Template on this page here Download Android Advanced Plus Webview Template. Currently this supports blob pdf files download.

, , ,

Post navigation

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.