Getting data from a webpage that uses jquery

I’ve had a project on hold for ages because I don’t know how to get data from web pages that use jquery. From what I can gather from web searches it is possible in other languages but still needs a fair bit of messing about and knowledge I don’t have. I wondered how difficult or easy it would be in Xojo.

I would like to be able to get it from a desktop app, but from what I read it needs some browser code (DOM?) to be accessed properly.

One option would be to get a browser to load the page and save it into temporary storage, then I can parse it as a normal page. I can see that HTMLViewer can print a page, but can I save it as HTML? Or how would I go about accessing a third-party browsers’ API?

The other thought would be to perhaps use Xojo’s web edition to run the jquery code and somehow pass the data back to the desktop app?

Or is there an easier way that I’ve missed completely?

You can use the HTMLViewer.ExecuteJavascript to run JavaScript/JQuery methods from the desktop.

There isn’t a way to officially access the return values of functions that I know of, and I’ve recently added a feedback request to add this ability.

<https://xojo.com/issue/33304>

You’ll find a potential workaround in the ticket notes, on how to access return values of JavaScript functions from a Desktop app. The methods described to pass data from JavaScript to Desktop is not very elegant… but it works.

Hopefully full access to the DOM will eventually be supported? It would certainly open the door to some creative ways to build desktop applications with a mixture of HTML5 and JavaScript.

Thanks, Alwyn.

I’ll give it a go!