Partilhar via


NewWindow3 event

Raised when a new window is to be created. Extends NewWindow2 with additional information about the new window.

Syntax

HTML Attribute <element NewWindow3 = "handler(event)">
attachEvent Method object.attachEvent("NewWindow3", handler)

 

Event information

Synchronous No
Bubbles No
Cancelable No

 

Event handler parameters

ppDisp [in, out, ref]

C++ An interface pointer that, optionally, receives the IDispatch interface pointer of a new WebBrowser object or an InternetExplorer object.
VB Object expression that, optionally, receives a new, hidden WebBrowser or InternetExplorer object with no URL loaded.

Cancel [in, out, ref]

Type: Boolean

A Boolean value that determines whether the current navigation should be canceled.

VARIANT_TRUE (true)

Cancel the navigation.

VARIANT_FALSE (false)

Do not cancel the navigation.

dwFlags [in]

Type: Unsigned Long

Variant. The flags from the NWMF enumeration that pertain to the new window.

bstrUrlContext [in]

Type: BSTR

The URL of the page that is opening the new window.

bstrUrl [in]

Type: BSTR

The URL that is opened in the new window.

Remarks

NewWindow3 is available only in Windows XP Service Pack 2 (SP2) or later. This event fires instead of NewWindow2.

The NewWindow3 event is not raised when the user selects the New Window command on the File menu in Windows Internet Explorer. Instead, this event precedes the creation of a new window in the WebBrowser in response to a navigation targeted to a new window, or from script using the window.open method. The event is raised during the following actions:

  • The user clicks a link while pressing the SHIFT or CTRL key.
  • The user right-clicks a link and selects Open in New Window or Open in New Tab.
  • There is a targeted navigation to a frame name that does not yet exist, or _blank.
  • Script invokes window.open.
  • A browser application calls Navigate or Navigate2 with the navOpenInNewWindow flag.

The application that processes this notification can respond in one of three ways:

  • Create a new, hidden, non-navigated WebBrowser object or InternetExplorer object that is returned in ppDisp. On return, the object that fired this event configures and navigates (including a BeforeNavigate2 event) the new object to the target location.
  • Cancel the navigation by setting Cancel to True.
  • Do nothing and do not set ppDisp to any value. This will cause the object that fired the event to create a new InternetExplorer object as a separate (non-hosted) process to handle the navigation.

Note   The NewWindow3 event is only fired when a new instance of Internet Explorer is about to be created. Calling showModalDialog or showModelessDialog does not trigger an event because they are not new instances of Internet Explorer. They are implemented as MSHTML host windows, which allows them to render and display HTML content but not hyperlinks between documents.

 

Note   The NewWindow3 event is only fired when a new instance of Internet Explorer is about to be created. Calling showModalDialog or showModelessDialog does not trigger an event because they are not new instances of Internet Explorer. They are implemented as MSHTML host windows, which allows them to render and display HTML content but not hyperlinks between documents.

 

See also

InternetExplorer

WebBrowser

Reference

NavigateComplete2

NewWindow2