Download File in iPad

Hello all, I have made a Web Application, that will be stationed on a server, using Xojo 2018r2. The client client side will be use a both a PC and a iPad to connect to it. The PC has not issues with the download, the iPad on the other hand, not so much.

The first time the Safari application opens, and you press to download the file from the site, you get an error and the page is no longer visible, but if you press the download button you can download the file normally and if you press the back button you get to the site like normal. But the second time you try to download a file, the address kinda flashes for a second like trying to change page, but it doesn’t, you stay at the same page without being able to download anything. If you close the Safari application and open it again, if you navigate to the site and press the download again, you get the previous and can download the file like before.

I am using a WebFile and my code for the download is as follows, with the ivXLSFile being a web file on the page and f an excel file I create.

If f <> Nil And f.Exists Then
  ivXLSFile = WebFile.Open(f)
  ivXLSFile.ForceDownload = True
  ShowURL(ivXLSFile.URL)
End If

My page is not safe (no idea if it makes any difference).

Does anyone know why I get this behavior and how to prevent it? I do not mind the error as long as the file actually downloads, but I cannot have the users open and close Safari every time they want to download something.

Thanks a lot for your time!!

Can you actually download files on an iPad?

Yeah, with the method described above. It is not ideal, but it can be done.

Where does it go?

You press the button to “open in”, select mail, or if it is a PDF, iBooks etc and you save it on the device.

What I did not mention was that the file is an Excel file. I have tested that with sheets that do not have too many lines, the are shown in Safari normally. The aforementioned behavior occurs only when there is a sheet that has more than 80(more or less) lines. With pdf files I have not encountered a similar problem.

When I get the Error page, the browser page get white and it simply writes “an unknown Error has Occurred (null)”, the URL is correct and I can still get the file. After I get the file or simply return I cannot get to that URL, nor get the file again.

Solved it, the problem was the .xls file. It seems Safari cannot open them consistently. I saved them as .xlsx files and the Issue has resolved it self.