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_Handled Gets whether the NewWindowRequested event is handled by host.
get_IsUserInitiated TRUE when the new window request was initiated through a user gesture such as selecting an anchor tag with target.
get_NewWindow Gets the new window.
get_Uri The target uri of the new window requested.
get_WindowFeatures Window features specified by the window.open.
GetDeferral Obtain an ICoreWebView2Deferral object and put the event into a deferred state.
put_Handled Sets whether the NewWindowRequested event is handled by host.
put_NewWindow Sets a WebView as a result of the NewWindowRequested.

The event is run when content inside webview requested to a open a new window (through window.open() and so on).

Applies to

Product Introduced
WebView2 Win32 0.9.430
WebView2 Win32 Prerelease 0.9.488

Members

get_Handled

Gets whether the NewWindowRequested event is handled by host.

public HRESULT get_Handled(BOOL * handled)

get_IsUserInitiated

TRUE when the new window request was initiated through a user gesture such as selecting an anchor tag with target.

public HRESULT get_IsUserInitiated(BOOL * isUserInitiated)

The Microsoft Edge popup blocker is disabled for WebView so the app is able to use this flag to block non-user initiated popups.

get_NewWindow

Gets the new window.

public HRESULT get_NewWindow(ICoreWebView2 ** newWindow)

get_Uri

The target uri of the new window requested.

public HRESULT get_Uri(LPWSTR * uri)

get_WindowFeatures

Window features specified by the window.open.

public HRESULT get_WindowFeatures(ICoreWebView2WindowFeatures ** value)

The features should be considered for positioning and sizing of new webview windows.

GetDeferral

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

public HRESULT GetDeferral(ICoreWebView2Deferral ** deferral)

Use the ICoreWebView2Deferral object to complete the window open request at a later time. While this event is deferred the opener window returns a WindowProxy to an un-navigated window, which navigates when the deferral is complete.

put_Handled

Sets whether the NewWindowRequested event is handled by host.

public HRESULT put_Handled(BOOL handled)

If this is FALSE and no NewWindow is set, the WebView opens a popup window and it returns as opened WindowProxy. If set to TRUE and no NewWindow is set for window.open, the opened WindowProxy is for an testing window object and no window loads. The default value is FALSE.

put_NewWindow

Sets a WebView as a result of the NewWindowRequested.

public HRESULT put_NewWindow(ICoreWebView2 * newWindow)

The target WebView should not be navigated. If the NewWindow is set, the top-level window returns as the opened WindowProxy.