You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/24 11:00:26 UTC

[GitHub] [cordova-plugin-inappbrowser] JensUweB edited a comment on issue #311: Download file not working

JensUweB edited a comment on issue #311:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/311#issuecomment-784982747


   I found out whats going on here. InAppBrowser uses the android web view by default. Android Web View does not handle downloads by default, because it cannot render or download files (except html, css & js of course), so you have to register a download listener and handle it yourself. If you don't handle it yourself and just register the listener, the web view will crash (and so will your app), if the user klicks a download link.
   
   As workaround, you can try to modify the java code of the InAppBrowser yourself [as described here](https://stackoverflow.com/questions/30390826/download-file-from-external-website-with-inappbrowser-cordova).
   
   Edit: Found another possible workaround, without messing around with native java code. [Link to Stackoverflow](https://stackoverflow.com/questions/47330075/inappbrowser-open-window-post-message). You can inject javascript into the browser, register with the injected script a custom click listener onto your anchor links and send the download url with over the message api back to your cordova context to download the file yourself. I'm working on that right now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org