I’ve seen a few threads on this but never really found a satisfactory answer.
I need to download a CSV file from a server and process it in my application. The user needs to log in via a third-party website (they don’t have an API available) in order to enable the download (the data is unique to the user), the login and session cookies in the HTMLViewer are required to initiate the download (hence I can not simply pass the download link along to a URLConnection or curlsmbs).
Looking for a solution on both Mac and Windows. Does anyone know a way?
Hi Christian,
this is an interesting question. I have the impression this is not directly possible with HTMLViever. Tried a few things with our content management system: Using event NewWindow i was able to load a picture into a new HTMLViewer, but can’t download it. It should be possible though to load that CSV-File into a new HTMLViewer and access it contents with javascript?
Better way could be to authorize via URLConnection, then you can download directly. May Proxyman can help to see, how authorization works.
Thomas
1 Like
Thanks for the reply. Unfortunately the user needs to log into either their Apple account or their Google account and authorizing via URLConnection is not only going to be ugly (dealing with 2FA and such) but it also feels shady to ask a user to enter their credentials into my application.
I realize from a security perspective there’s no difference between entering it into my app’s HTMLViewer vs my app’s UI, but to the user it at least feels safer and more secure doing it in a “browser window.”
Hello,
it will certainly need a little customization, but basically you can do it like in this project:
https://nözl.de/lc9ee
It checks for url that ends with “csv”, lods the file with js and sends the contents to Xojo.
Marius
3 Likes
Thank you for this. It’s a very interesting approach and a great starting point. Appreciate it!