Results 1 to 5 of 5

Thread: Get Javascript Generated HTML from WebBrowser

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Get Javascript Generated HTML from WebBrowser

    I'm loading HTML into the web browser control, and adding a bit of javascript that hightlights a section of html when the user clicks on the area, by changing the classname. If you know the FireBug addin for Firefox, it's very similar to that. But what I need to do after this, is take the HTML source, and find where they clicked. But when I get the DocumentText of the webbrowser control, it's the original source. Not the source with the added class name.

    Is there a way to get the source code with the javascript generated html?
    Thanks
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Get Javascript Generated HTML from WebBrowser

    if you know exactly what the javascript does, can't you get the original html from your webbrowser, then apply the same changes?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: Get Javascript Generated HTML from WebBrowser

    The javascript adds a class to a dom element that the user clicks on. So the javascript doesn't do anything until there is user interaction.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: Get Javascript Generated HTML from WebBrowser

    Well I came up with a way. I'm not sure if it's the best way. But it works.

    I modified the js to raise an event that the .net form processes. The js passes in the html source, which is the must up-to-date with the changes made by the js. If anyone else has any other ideas, I would still like to hear them
    Thanks
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  5. #5
    Addicted Member
    Join Date
    Dec 2006
    Location
    London, England
    Posts
    142

    Re: Get Javascript Generated HTML from WebBrowser

    You can ofcourse envoke the script, if you know what its called by using this method.

    Code:
    WebBrowser1.Document.InvokeScript(JavaScript)
    Redmo

    *Edit:Forget it, sorry, i totally misread what you posted.. *
    The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp


    Please rate the posts that have helped. Makes us feel all warm and fuzzy

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