description | title | author | ms.author | ms.date | ms.topic | keywords |
---|---|---|---|---|---|---|
Event args for the NewWindowRequested event. |
WebView2 Win32 C++ ICoreWebView2NewWindowRequestedEventArgs |
MSEdgeTeam |
msedgedevrel |
10/07/2020 |
reference |
IWebView2, IWebView2WebView, webview2, webview, win32 apps, win32, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2NewWindowRequestedEventArgs |
[!INCLUDE deprecation-note]
interface ICoreWebView2NewWindowRequestedEventArgs
: public IUnknown
Event args for the NewWindowRequested event.
Members | Descriptions |
---|---|
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. |
get_NewWindow | Gets the new window. |
get_Uri | The target uri of the NewWindowRequest. |
GetDeferral | Obtain an ICoreWebView2Deferral object and put the event into a deferred state. |
put_Handled | Sets whether the NewWindowRequestedEvent is handled by host. |
put_NewWindow | Sets a WebView as a result of the NewWindowRequest. |
The event is fired when content inside webview requested to a open a new window (through window.open() and so on.)
Gets whether the NewWindowRequestedEvent is handled by host.
public HRESULT get_Handled(BOOL * handled)
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)
Gets the new window.
public HRESULT get_NewWindow(ICoreWebView2 ** newWindow)
The target uri of the NewWindowRequest.
public HRESULT get_Uri(LPWSTR * uri)
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.
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.
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.