interface ICoreWebView2NewWindowRequestedEventArgs

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

interface ICoreWebView2NewWindowRequestedEventArgs
  : public IUnknown

Event args for the NewWindowRequested event.

Summary

Members Descriptions
get_Uri The target uri of the NewWindowRequest.
put_NewWindow Sets a WebView as a result of the NewWindowRequest.
get_NewWindow Gets the new window.
put_Handled Sets whether the NewWindowRequestedEvent is handled by host.
get_Handled Gets whether the NewWindowRequestedEvent is handled by host.
get_IsUserInitiated IsUserInitiated is true when the new window request was initiated through a user gesture such as clicking an anchor tag with target.
GetDeferral Obtain an ICoreWebView2Deferral object and put the event into a deferred state.

The event is fired when content inside webview requested to a open a new window (through window.open() etc.)

Members

get_Uri

The target uri of the NewWindowRequest.

public HRESULT get_Uri(LPWSTR * uri)

put_NewWindow

Sets a WebView as a result of the NewWindowRequest.

public HRESULT put_NewWindow(ICoreWebView2 * newWindow)

The target webview should not be navigated. If the NewWindow is set, its top level window will return as the opened WindowProxy.

get_NewWindow

Gets the new window.

public HRESULT get_NewWindow(ICoreWebView2 ** newWindow)

put_Handled

Sets whether the NewWindowRequestedEvent is handled by host.

public HRESULT put_Handled(BOOL handled)

If this is false and no NewWindow is set, the WebView will open a popup window and it will be returned as opened WindowProxy. If set to true and no NewWindow is set for a window.open call, the opened WindowProxy will be for an dummy window object and no window will load. Default is false.

get_Handled

Gets whether the NewWindowRequestedEvent is handled by host.

public HRESULT get_Handled(BOOL * handled)

get_IsUserInitiated

IsUserInitiated is true when the new window request was initiated through a user gesture such as clicking an anchor tag with target.

public HRESULT get_IsUserInitiated(BOOL * isUserInitiated)

GetDeferral

Obtain an ICoreWebView2Deferral object and put the event into a deferred state.

public HRESULT GetDeferral(ICoreWebView2Deferral ** deferral)

You can use the ICoreWebView2Deferral object to complete the window open request at a later time. While this event is deferred the opener window will be returned a WindowProxy to an unnavigated window, which will navigate when the deferral is complete.