Results 1 to 10 of 10

Thread: Getting HTML source code

  1. #1

    Thread Starter
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    Getting HTML source code

    VB Code:
    1. Form1.txtHTML = Form1.WebBrowser1.document.body.innerHTML

    currently i have a web browser in which i need to get the souce code for the page i am viewing, previously i was using the above code with the ie control, but i have swapped this control for the firefox activex control due to other issues. This now causes an error of

    "Automation Error
    Library not registered"

    i have to get the code from this browser window as using a different control takes me to the home page of the site (need to be logged in to view this page)
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  2. #2

    Thread Starter
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    Re: Getting HTML source code

    ...so noone knows how to get the source code for a webpage using the firefox control
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  3. #3
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Getting HTML source code

    Looks like you need to register the firefox control first

  4. #4
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Getting HTML source code

    Why don't you use Inet (MS Internet Transfer Control) to get the source?

    VB Code:
    1. Dim source As String
    2.     source = Inet1.OpenURL("http://www.blablabla.com")

  5. #5
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Getting HTML source code

    Cool site gavio

  6. #6

    Thread Starter
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    Re: Getting HTML source code

    @gavio: last line of the post... i cannot use another control to access the page as the way i access this page is to go to one page, sign in, and then go to another page, and just loading the page direct with inet gives me the code for the sign-in page. theres probably a long-winded way of doing it using inet but it has to repeat this a lot so i want to take as short a time as possible
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  7. #7

    Thread Starter
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    Re: Getting HTML source code

    and the component is registered, as everything else works, it loads pages and acts as a browser fine. this is the line that causes the error:

    VB Code:
    1. strSourceCode = WebBrowser1.document.body.innerHTML
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  8. #8
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Getting HTML source code

    You said in post one you were using the Firefox control because of other reasons....what are the other reasons as I have used the Webbrowser control to get the source of a page without any problems?

  9. #9

    Thread Starter
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    Re: Getting HTML source code

    yea getting source from the ie webbrowser control was no problem at all, however for some reason ie webbrowser kept getting errors on every page that i either had to click yes "continue running scripts" or set silent=true and then it didnt render the web page correctly
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

  10. #10
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Getting HTML source code

    Quote Originally Posted by Arachnid13
    however for some reason ie webbrowser kept getting errors on every page
    Are you sure the java scripts errors were on every page? Do you have an example of a site that gives the error?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width