HTML-source code as a string

Hello, i have a HTMLViewer on a webpage.
Now i want to get the source code as a string from the HTMLViewer like the right-mouse-key click -> show source code.
How is that possible?

I don’t understand the “Downloading” example. Where is hidden the web address “http://…” ?
Why should i write the text “Hello World” in a txt file and download it?
How is it possible to download the HTTP?

[quote]HTTPSocket.Get ( URL As String, File As FolderItem )
Asynchronously downloads the content from the URL directly to the FolderItem.
The DownloadComplete event is called when the response data has finished downloading.
You need to subclass HTTPSocket (or use AddHandler) so that you can handle the appropriate events.[/quote]

I had problems to find informations about “Get”. Xojo docs found nothing but the Internet :slight_smile:

So i changed the code to:

dim s as string dim h as new HTTPSocket s=h.Get("",90) 'Backdrop=JPEGStringToPictureMBS(s) TextField1.Text=s

HTTPsocket that is it! Thank you! That works! :slight_smile:

Hi Shao,
it’s long time that I have the same issue of Peter.
If I use the HTML viewer component, you will see the content of the website inside the component but is not possible to see the source code of the same page.
if I use the HTTPSocket it’s true I can get the source code, but it’s not the same as the one in the HTML viewer. I’m I wrong?
as per my understanding, another get will be done by the HTTPsocket component and the content will not be displayed in the HTML viewer component but just stored in a variable.

This will be a big issue for example if I allow the user to navigate using the HTML viewer component and maybe after ten pages visited I want to get the source code of the page. is that possible?

I was a big fun of RealBasic but I had to move to VB.NET only for this feature not available.

Anyone able to give me a reliable solution so that I can come back using XoJO?

Thanks a lot everybody.

You can get the source code of the HTMLViewer, but any of the external files it loads, you will need to parse out of the source code and download separately… Add a HTMLViewer to a window and then add the following events and code…

Sub DocumentComplete(URL as String) me.ExecuteJavaScript "window.status = document.getElementsByTagName('html')[0].innerHTML;" End Sub

Sub Open() me.LoadURL "" End Sub

Sub StatusChanged(newStatus as String) MsgBox newStatus End Sub

how implement for webhtmlviewer, because dont have Sub DocumentComplete

No idea, I do not use the Web build in Xojo… Did not see that this question was about the WebHTMLViewer (should have been tagged for the Web)…

It’s an event…

yess that is an event but for webhtmlviewer dont have that event

Husnul, please post your question in the web channel. The WebHTMLViewer has nothing to do with the desktop one.