• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

WebBrowser Control Source code

Is there a way of pulling the source code out of a webbrowser control?

I know you can use the inet control, however its a dynamic application, which uses previous screens to compile the final resulting page, once this page is reached, I want to be able to read the final page, and use it.

Any ideas?

Tony
0
tonelm54
Asked:
tonelm54
1 Solution
 
rettiseertCommented:
Do you mean the HTML code of the current page in the control?

WebBrowser1.Document.documentElement.outerhtml
0
 
cachedVBCommented:
Hi tonelm54,

rettiseert's code is what you are looking for.  If you want to save it to disk, here is a good function for doing so.

Sub SaveWebBrowser(WB As WebBrowser, ByVal FileName As String, _
    Optional SaveAsPlainText As Boolean)
    Dim Text As String, fnum As Integer

    If SaveAsPlainText Then
        Text = BW.Document.Body.innerHTML
    Else
        Text = BW.Document.documentElement.OuterHTML
    End If

    ' save to file
    fnum = FreeFile
    Open FileName For Output As #fnum
    Print #fnum, Text;
    Close #fnum
End Sub    

cachedVB
0
 
tonelm54Author Commented:
OK quickest repsonse EVER! Thanks, and yes!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now