HTMLViewer get page source

Hi all,

I am getting started on XOJO been using .net for a long while. I am trying to get the source code of a web page (desktop,mac) but I could not find this action for HTMLViewer. Have already looked into the forum but I could not get anything conclusive.

HTML Viewer is a little limited. The easiest way to get the source would be to track the page you’re on using the CancelLoad function and use a HTTP Socket to get the source.

Mac? Win? Linux?
Desktop project? (or iOS/Web?)

MBS Plugins have a lot of HTMLViewer extensions:

[code] dim html as string

#if TargetMacOS then

html = HTMLViewer1.mainFrameMBS.dataSource.data

#elseif TargetWin32 then

if HTMLViewer1.Renderer = 1 then
  html = HTMLViewer1.ChromiumBrowserMBS.MainFrame.Source
else
  html = HTMLViewer1.IEHTMLTextMBS
end if

#elseif TargetLinux then

html = HTMLViewer1.LinuxWebViewMBS.MainFrame.DataSource.Data

#else
?
#endif[/code]

4 ways so we can cover most platforms :slight_smile:

Oh that’s straight forward Christian, sorry newbie silly question where can I go for the MBS Plugins.

http://www.monkeybreadsoftware.de/xojo/

Thanks a lot Scott

Danke Christian

Is there a good solution built into XOJO without purchasing MBS?

Got it, here is an example project to download: http://blog.xojo.com/2015/05/06/httpsocket_now_with_support_for_http_11/

Basically add a class to a project of type xojo.net.httpsocket - then add a ‘page received’ event to that. In there you can access/convert the http 1.1 data as a string. Check out the example above for the details.