Since it’s clear as mud in the Xojo docs, is there a code flow for providing downloads from a page displayed in a HTMLViewer? I understand that the HTMLViewer IS just a viewer, and that I need to use HTMLSocket to retrieve the file linked, but how do we trap the clicked link and then pass the actual link of the linked file to the HTTPSocket?
Get the URL for the file in the CancelLoad event and Return True
Create a new URLConnection
Pass the file name to a URLConnection
Create a folderitem to receive the file
Use the URLConnection’s Send method passing the “GET” key, the URL, and the folderitem to save the downloaded file into.
I’ve taken the WEBViewer out of my project and created a standalone app. I’m not receiving the linked file URL in the CancelClose event. Have I missed something? Bug? Here’s the slimmed down project if someone who understands this can take a look.
Tim, i tried the example and it seems to me that it works just fine, i tested the download of 3 files and all 3 were perfectly downloaded:
ArGest_Backup_4.0.0.235_Windows-x86_64_Setup.exe : 17,540,938 bytes
readme.rtf : 5507 bytes
tolis_tape_tools_manual_01-10-08.pdf : 305064 bytes
I have no idea what the problem could be. Sorry to be not as helpful as i wanted.
HOWEVER … the issue appears on Linux, not macOS or Windows. Apparently I was running the Linux test in a VM on my macOS box and botched my own testing.
So, I’ve updated the subject and am looking into an alternative for Linux. This may be why I started this in Add-Ons - I was assuming that I would need to find a plugin solution.
Ah I understand what your post meant now. That’s kind of cool that it’s that well blended!
@Christian Schmitz has wrapped up web viewers for macOS and Windows. Perhaps it might be worth seeing if he’s got any time to help wrap up something on Linux, as this is kind of a medium-sized issue!
First file a feedback case, so I can read about it.
Include sample project. Then let’s ask @William Yu to take a look and see if there is an easy to fix bug in Xojo passing wrong URL…
Really not something that Xojo needs to worry about on my account since it’ll never make it back to 19r1.1 and anything newer is a moot point for me, but here it is if you can do something, Christian.