Search Tools Links Login

UPDATED! WebBrowser Control Bug in IE 5.5

After developing a full-blown application (just went out to beta) for my employer, I uncovered a bug in IE 5.5 that you may want to know about.

Original Author: Rabid Nerd Productions


UPDATE! - 12/26/2000

UPDATE! - Sent from Microsoft

Thanks for sending in the codes. I am able to
reproduce the same problem with your code. I verified that in IE5 navigate2 accept a string as
URL, in IE5.5 it only accept a variant. Or you could pass in the url inline without using a
variable. Then I looked at the source of both versions and set up a debugger to verify. Here is the situation:

When you specific the URL as a string, VB will passed in VT_BSTR|VT_BYREF

In both IE5.0 and IE5.5, the header info are the same in the IDL file which accept a variant

[id(0x000001f4), helpstring("Navigates to a URL or file or pidl.")]

HRESULT Navigate2(

    [in] VARIANT* URL,

    [in, optional] VARIANT* Flags,

    [in, optional] VARIANT*

    [in, optional] VARIANT* PostData,

    [in, optional] VARIANT* Headers);

However, the implementations are different.

In IE5.0, the URL param could be VT_BSTR,

In IE5.5, it uses a function to determine the values of the URL and it only accepts VT_BYREF |

So, it returns an error E_INVALIDARG when VB passed in VT_BSTR|VT_BYREF.

And I filed a bug on this.

So at the mean time, you would have to use variant as I believe passing the url inline
probably won’t go too far in most applications.

Please let me know if you have any more concerns.

Joshua Lee (MCP + Site Building)

Content Lead

Internet Client Team

Microsoft Developer Support

End UPDATE. Original article follows:

In the Microsoft Knowledge Base article at:

A bug in IE 5.5 users' WebBrowser controls is exposed.
The WebBrowser1_NavigateComplete event is NOT FIRED when the control is set to visible = FALSE.(Invisible)

I have also found another bug (and I am working with Microsoft on it) with the 5.5 WebBrowser Control:

When you use a string variable in the Navigate2 method, the control fails to navigate (and may cause an error!)

Here is a code that you can place in a form with a webbrowser control on it:

Sub form_load()
Dim urly As String
urly = ""
WebBrowser1.Navigate2 urly
End Sub
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)
MsgBox "Hello!"
End Sub

When you execute this code on a computer with IE other than 5.5, You will get the appropriate MsgBox with
Hello! in it (and our website). With 5.5, however, you will get and Error 5.

The workaround is to declare the URL variable (urly) as a Variant -OR- Use the Navigate (no 2) Method. (as described in the
MS Knowledge Base (See #28). The variant may not be as efficient as the string type, but it works on ALL versions of IE.

If you appreciate this 'bulletin' of sorts, I humbly ask for a vote. I understand this is not an application, but hey
it's important to anyone with a webbrowser control on their app!

Have Fun,
Herbert L. Riede
Programmer,, Inc.

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 85 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.