Microsoft KB Archive/320491

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

Article ID: 320491

Article Last Modified on 1/14/2005

-

APPLIES TO


 * Microsoft Internet Explorer 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 &quot;Applies to&quot; section.



Steps to reproduce the behavior
 Create a Standard EXE project in Microsoft Visual Basic 6.0. By default, a form that is named Form1 is created.  Add the following controls to Form1:   Object                   Name              Text         Property --                                                             TextBox                  Text1                          MultiLine=True CommandButton           cmdVbd            VBD  From the Project menu, click References, and then click to select Microsoft Internet Controls from Available References.  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 &quot;http://Yourserver/YourVBD.VBD&quot;, &quot;&quot;, &quot;Application Frame&quot; End Sub

Private Sub Form_Load Set m_oIE = New InternetExplorer m_oIE.Visible = True m_oIE.Navigate2 &quot;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 &quot;BeforeNavigate2 &quot; & URL End Sub

Private Sub AddToList(ByVal sStr As String) Text1.Text = Text1.Text & vbCrLf & sStr End Sub  Replace Yourserver and YourVBD.vbd in the URL.</li> Save the Project as Driver.vbp.</li>  Copy the following HTML code to Notepad and paste the code in the Frameset.htm file. <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Frameset//EN&quot;> <HTML> <FRAMESET rows=50%,50% Border=yes  > <FRAME name=&quot;Blank&quot; src=&quot;&quot;> <FRAME name=&quot;Application Frame&quot; src=&quot;about:blank&quot; scrolling=no> </HTML> </li> Put the Frameset.htm file, the .vbd file, and the .cab file that belongs to the .vbd file, on the server.</li> Open the Driver.vbp project. Press F5 to run the Driver.vbp project.</li> 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.</li></ol>

Additional query words: onbeforeunload active document word excel iframe fails

Keywords: kbbug kbpending KB320491

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.