Results 1 to 13 of 13

Thread: How di I display generated html into a webbrowser control?

  1. #1
    Gerco
    Guest
    Well, see the subject.

    I basically need the webbrowser to be able to navigate to a page, download it, have my program decrypt the page and display it.

    Ideas, anyone?

    Gerco.

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    do you need the .html source

    webBrowser.document is the html sourse!!

  3. #3
    Guest
    Well, no.

    When I do: msgbox Webbrowser1.document it just displays: [object]

    And I need the source before the control displays it, then I need to change it and then the control must display it. The control won't recognise the file as HTML, because it needs to be decrypted first.

    Gerco.

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    sorry try:

    Webbrowser1.document.innerHtml

    i think it's that

  5. #5
    Guest

    Angry

    Code:
    html = crypt(html, key)
    WebBrowser1.Document.innerHtml = html
    Gives me:Runtime error: 438: Object Doesn't support this property or method

    Gerco.

  6. #6
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    ohhhhhhhhhhhhhhhhh

    you want to set the html in the webBrowser

    i don't know how, i dunno if you can!!

    sorry for the missunderstanding

  7. #7
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    In that case try this:

    put your generated html in an .html file that you will
    create, and then just point the webBrowser to this .html file,


    how does this sound!!

  8. #8
    Guest
    Never mind..

    I just want to give the webbrowser an url, it downloads the data, notifies me (by an event, already done), I decrypt the document, and give it to the webbrowser.

    The webbrowser will then display the decrypted document.

    Gerco.

  9. #9
    Guest
    It's actually this:

    Code:
    Text1.Text = WebBrowser1.Document.documentElement.innerHTML

  10. #10
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    not sure what you mean with the decript part,but
    you CAN'T set the webBrowser document(as far as i know)
    try what i suggest:

    I just want to give the webbrowser an url, it downloads the data, notifies me (by an event, already done), I decrypt the document
    ****************
    put the decrypt document in a .html file that you will create
    ****************
    , and give it to the webbrowser.


    oh well,
    Never mind..
    maybe that what i'll do!!

  11. #11
    Guest
    Works kinda nice Matthew, but still some trouble:
    Code:
    Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
        If Right$(UCase$(URL), 3) <> "GTW" Then Exit Sub
        Dim urlToOpen As String
        urlToOpen = URL
        MsgBox "Decoding " & urlToOpen
        b() = Inet1.OpenURL(urlToOpen, icByteArray)
        For i = LBound(b) To UBound(b)
            html = html & Chr$(b(i))
        Next i
        Open App.Path & "\tmp.html" For Output As 1
            Print #1, crypt(html, key)
        Close 1
        WebBrowser1.Navigate2 App.Path & "\tmp.html"
        Cancel = True
    End Sub
    The idea is: when the browser loads an URL with .gtw extension, it loads the file and decodes it, then points the webbrowser to the temp file.

    The problem: when the webbrowser finishes loading the temp file, it continues to a navcancel page because of the cancel=true in the code.

    And when I try and get the browser to download the file itself, it pops up a dialogbox asking me if I want to save the file, because it doesn't recognise the file format :-(

    Ideas anyone?

    Gerco.

  12. #12
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    I don't suppose this would work but have you tried cancelling first and then making the browser navigate to the temp file you decrypted?
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

  13. #13
    New Member
    Join Date
    Feb 2001
    Posts
    6
    You can set the html source code directly as shown below:

    WebBrowser1.Navigate "about:<html>your text here
    <img src='c:\Internet\somefile.gif'></img></body></html>"

    You don't need to 'Navigate' to an external file.

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