The scenario goes like this: I open a website in InAppBrowser, after the user ends with the work over there, the site generates a .pdf for the user to download, the problem is that the pdf does not download, it opens it in the browser.
Is there a way to make it download from the InAppBrowser? I'm currently working on an iOS app, so the solution would be better for iOS.
Thanks in advance.
Following @jcesarmobile advices this is what I came up with:
First I had to install the cordova-plugin-file-transfer
Open URL
Create a listener on that
windowref
for aloadstart
event and check if what's being loaded is a pdf (that's my case).Create the function that will handle the file download and then open it:
The problem i'm facing now is the path where it downloads, I just can't open it. But well, at least file is now downloaded. I will have to create a localStorage item to save the paths for different files.
Many validations are missing in this steps, this was just an example I made quickly to check if it works. Further validations are needed.