BUG: The BeforeNavigate2 event does not occur in Internet Explorer when you move away from a frameset that contains an active document (320491)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5
  • Microsoft Internet Explorer (Programming) 6.0

This article was previously published under Q320491

SYMPTOMS

You move to an active document such as an office document or a .vbd file in a frame of a multi-frame HTML file. When you move to a different page by clicking Home or Favorites in Microsoft Internet Explorer, the BeforeNavigate2 event does not occur to let you to cancel the navigation.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. Create a Standard EXE project in Microsoft Visual Basic 6.0. By default, a form that is named Form1 is created.
  2. Add the following controls to Form1:
       Object                   Name              Text         Property
       ----------------------------------------------------------------------                                                           
       TextBox                  Text1                          MultiLine=True
       CommandButton            cmdVbd            VBD
    						
  3. From the Project menu, click References, and then click to select Microsoft Internet Controls from Available References.
  4. Copy the following code sample and paste the code sample in the code window.
    Private WithEvents m_oIE  As InternetExplorer
    
    Private Sub cmdVbd_Click()
       m_oIE.Navigate2 "http://Yourserver/YourVBD.VBD", "", "Application Frame"
    End Sub
    
    Private Sub Form_Load()
        Set m_oIE = New InternetExplorer
        m_oIE.Visible = True
      m_oIE.Navigate2 "http://Yourserver/frameset.htm    
    End Sub
    
    Private Sub m_oIE_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
     AddToList "BeforeNavigate2 " & URL
    End Sub
    
    Private Sub AddToList(ByVal sStr As String)
        Text1.Text = Text1.Text & vbCrLf & sStr
    End Sub
    					
  5. Replace Yourserver and YourVBD.vbd in the URL.
  6. Save the Project as Driver.vbp.
  7. Copy the following HTML code to Notepad and paste the code in the Frameset.htm file.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
    <HTML>
    <FRAMESET  rows=50%,50% Border=yes  >
    <FRAME name="Blank" src="">
    <FRAME name="Application Frame" src="about:blank" 
    scrolling=no>
    </HTML>
    					
  8. Put the Frameset.htm file, the .vbd file, and the .cab file that belongs to the .vbd file, on the server.
  9. Open the Driver.vbp project. Press F5 to run the Driver.vbp project.
  10. Click VBD. Notice that the text box shows that the BeforeNavigate2 event occurs. Now locate http://www.msn.com and notice that the BeforeNavigate2 event does not occur.

Modification Type:MinorLast Reviewed:1/14/2005
Keywords:kbbug kbpending KB320491 kbAudDeveloper