Ionic 3 inappbrowser download files

I'm developing a mobile app using Ionic 3. I use InAppBrowser native plugin to show an external website using his.inAppBrowser.create(url, '_blank', this.options); method in Ionic 3.

The external website displays dashboard and other web design. In some pages dashboard has download pdf/xl option, When I click the download buttons, it works fine in all browsers.

But when I call that external website from InAppBrowser in the Ionic 3 Mobile app, the download links in that page are not functional.

How can I download files from website using ionic 3 inappbrowser? Please help me anybody

Web dashboard has developed web team using Spring boot, java. One of the functionality of this website is to generate form data to pdf/xl and donwload as file when it is needed.

I have a two buttons for pdf and xl to download options to download. When you click a file to download, Server side code will create file from the Server and attached it with HTTP Response.

I have been trying this past two days but there is no LUCK :-(

Tried below links,

Phonegap/Cordova InAppbrowser File Download issue

But not getting any solution

Below is my ionic 3 code

   let target = "_blank";
   this.inAppBrowser.create(url, target, this.options);
   this.inAppBrowser.addEventListener('loadstart', function (event) {
   console.log("eventeventevent -- ", event);
   });

Please help me anybody regarding this

Upvotes: 1

Views: 1353

Answers (1)

barricade
barricade

Reputation: 19

I faced the same issue few days back when I noticed that the PDF files could not be downloaded through "InAppBrowser".

So, what I did was I changed the target to "_system". When you do that your PDF File will be opened in the app through which you normally open your PDF Files (You must have set it in your preferences) or it would give you a prompt like "Open file with ... ".

Upvotes: 0

Related Questions