DOC: Setting Cancel to TRUE in NewWindow2 Stops Navigation

ID: Q181779

The information in this article applies to:

SUMMARY

The documentation installed with the Internet Client SDK versions 4.0 and 4.01 states that setting the Cancel flag to TRUE in an event handler for the NewWindow2 event prevents the new window from opening. This is correct.

However, the documentation also states that the navigation will occur in the current browser window. This is incorrect. By design, the new browser window does not open and the intended navigation fails.

This error has been corrected in the online version of the Internet Client SDK, which is available at http://www.microsoft.com/msdn/sdk/inetsdk/help.

MORE INFORMATION

Assuming a Visual Basic project that uses the Web Browser Control, when the following Visual Basic code is executed in response to "window.open" in script or "Open In New Window" command from the context menu, no new window will open and no navigation will occur:

   Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
       Cancel = True
   End Sub

Keywords          : kbdocfix kbdocerr AXSDKWebBrowser 
Version           : WINDOWS:4.0,4.01
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: June 16, 1998