Link to home
Start Free TrialLog in
Avatar of viktor1983
viktor1983

asked on

WebBrowser control navigation...

hi,

i've created a webbrowser control and filled it's innerhtml from database. my question is, when i click on a link on the control, it doesn't do anything (on some computers, especially on mine it works fine), but when i try to save the page the link points to, it saves it successfully (base href set correctly in innerhtml)

what should i do to make those links work?
Avatar of zzzzzooc
zzzzzooc

Check the link's HREF.

For example...
Private Sub Command1_Click()
    WebBrowser1.Navigate "about:blank"
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
        DoEvents
    Loop
    WebBrowser1.Document.body.innerhtml = "<base href=http://www.yahoo.com><a href=test.html>Test</a>"
End Sub

..causes the link's HREF to be "http://www.yahoo.com/test.html" instead of just "test.html".
Avatar of viktor1983

ASKER

i know that, base href is set correctly, when i try to save the document, it works perfectly... but when someone tries to open it, it doesn't do anything.... doesn't display error page, nothing.... but it works fine on my computer ;-\
By "Check the link's HREF.", I meant for you to post it here. The HREF of the link for you and the systems it doesn't work on.

>>but it works fine on my computer
If it only works fine for you, it may be due to it being a development-machine. Any references, etc. (such as using "Active Accessibility" (WM_HTML_GETOBJECT)) may be required. It'd help to remove any error-handlers.
the HREF is built here:

base = "<base href=""" & App.Path & "/data/" & dname & "/"">"

then i put the contents to the webbrowser with the "base":

wb = base & app.Data1.Recordset!szoveg
html_text = base & vbCrLf & wb
WebBrowser1.Document.body.innerHTML = html_text

now i put an msgbox into the app that displays the base href, and it's correct on the computers too that doesn't display the link, the file that the link points to is in it's place, you can save it by clicking on save as... only doesn't display it ;-\

i'm new to vb, so don't be too confused... but what is WM_HTML_GETOBJECT? i've looked for Active Accessibility in the project --> references option, but haven't found anything...

i've made a deployment package, but the results are still the same, and the problem exists... ;(
ASKER CERTIFIED SOLUTION
Avatar of zzzzzooc
zzzzzooc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i've solved the problem by saving the "contents" to disk, then using navigate2 to get there...

thanks for your advice, i'll try to solve using this :)
Well if what you're doing now works, it's just a "zone" issue as I mentioned. Good luck.