WebBrowser Control Problem
Hi Everyone,
I added a Webbrowser Control to my program and going to the following page "http://217.150.114.84/newsite/mainpage.aspx" using the following syntax
WebBrowser1.Navigate2 "http://217.150.114.84/newsite/mainpage.aspx", 0, 0, "", ""
My problem is that if I borwse the page in a normal internet browser the title "Innovating Payment Technology" in displayed ok but when I display the page in my vb6 program the title does not show properly (last part of it is missing). This happens in other pages of the same website.
Anyone has any idea what I am missing. I think it is the style.css but I am not sure how that works out.
10x
Ivan
Re: WebBrowser Control Problem
Try using TitleChange event handler:
Code:
Private Sub WebBrowser1_TitleChange(ByVal Text As String)
Me.Caption = Text
End Sub
1 Attachment(s)
Re: WebBrowser Control Problem
My problem is not the title of the form but the way the webpage is displayed on the screen. As shown in the attached image
Re: WebBrowser Control Problem
I think it is due to the CSS styling... and IE is having issues on CSS styles... !
Re: WebBrowser Control Problem
Ah...then the news is not good...it's to do with the webbrowser itself rather than anything you can do...try viewing the same page in Internet Explorer on your PC and see if it displays properly. There's a chance it will as the webbrowser you're using and the IE you have are different versions, but if you haven't updated IE then you'll probably find it'll be the same in IE as in your webbrowser.
I get the feeling it's something to do with how the webbrowser control does the displaying of classes when drawing the page.
Edit: I'd have got there before Akh if I hadn't taken a look at the source for that page before replying :-P
Re: WebBrowser Control Problem
So is there a way to change the version of IE used in VB6 cause in my normal browser the page display correctly. I made sure my components use the same dlls like IE8 but I'm still having the same problem
Re: WebBrowser Control Problem
If it displays fine in IE8 it should display fine in the webbrowser, but if your "normal browser" isn't IE you shouldn't make the comparison :-)
A simple fix as I'm assuming you are ONLY using this site with it...when navigation is complete, manually edit out the stylesheet information and have it displayed how you want it...few people know that you can actually write to document.body.innerhtml with webbrowser, most think it's a one-way street, but you can get the HTML and edit it then replace it back. It *ISN'T* the perfect solution, but it's a possible way to sort it out and you don't want to know how much work the alternatives would be, although I am sure someone will surprise me and point out one I didn't know about :-)
Re: WebBrowser Control Problem
My "Normal" Browser is IE8 but in a vb6 WebControl it still doesn't display well. Can you give me a small example to how to edit the style sheet after the page is loaded just to have a starting point
10x
Ivan
Re: WebBrowser Control Problem
Not having used webbrowser in a while, and almost never used it for writing to the browser window, I can't be much help to you and I would have pointed you to a tutorial by Static (a poster here) if it was still online, but sadly it isn't.
BASICALLY though, you need to wait for webbrowser.busy = false (or checking status, or both, I've mentioned to other people here before that both the functions can return what some might consider false-positives with regards to whether the webbrowser is actually complete or not) then you need to get the HTML into a string and parse the data how you want and put the HTML back into the webbrowser...I'm sure other people would be more knowledgeable than me in the code required, I've always switched to using winsock for my web browsing, but you DON'T want to get into that just for what you require, it is definitely a solution and it'd do everything you want and a hell of a lot more, but the amount of programming you'd need to do would be huge compared to what you need to do at the moment :-)