Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: Events Not Firing When IE4 WebBrowser Placed On Web Page

View products that this article applies to.

This article was previously published under Q183048

↑ Back to the top


WebBrowser events such as DocumentComplete, DownloadComplete, BeforeNavigate2, and others do not fire when you host the WebBrowser control in an HTML page under Internet Explorer 4.0x.

↑ Back to the top


The WebBrowser ActiveX control is not designed to be used in an HTML OBJECT tag.

↑ Back to the top


Microsoft does not support use of the WebBrowser control in an HTML OBJECT tag. Microsoft recommends using IFRAME or FRAMEs instead of embedding the WebBrowser control in HTML.

↑ Back to the top


This behavior is by design.

↑ Back to the top

More information

You cannot write Script event handlers for WebBrowser control events, such as DocumentComplete, BeforeNavigate2, and other events, when you host the WebBrowser control in an HTML page by using the OBJECT tag. These events are not fired. These events are not fired even if the WebBrowser control is wrapped in another ActiveX control and then embedded in HTML.

If the reason for hosting the WebBrowser control in an HTML page is to display documents within your Web page, Microsoft recommends that you use the IFRAME tag.

Steps to Reproduce the Behavior

  1. Type and then save the following HTML as C:\Page1.htm:
       <TITLE>WebBrowser Control in HTML</TITLE>
    Sub WebBrowser1_BeforeNavigate2(pDisp, URL, Flags, _
          TargetFrameName,  PostData, Headers, Cancel)
       MsgBox "BeforeNavigate2"
    end sub
    Sub WebBrowser1_DocumentComplete(pDisp, URL)
       MsgBox "DocumentComplete"
    end sub
    Sub Window_OnLoad()
       WebBrowser1.Navigate ""
    End Sub
  2. Navigate to C:\Page1.htm from Internet Explorer 4.0.
DocumentComplete and BeforeNavigate2 events are not fired.

↑ Back to the top


For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top

Keywords: KB183048, kbprb, kbnofix, kbfaq, kbcode

↑ Back to the top

Article Info
Article ID : 183048
Revision : 3
Created on : 5/11/2006
Published on : 5/11/2006
Exists online : False
Views : 377