Aracılığıyla paylaş


CoreWebView2.NewWindowRequested Event

Definition

NewWindowRequested is raised when content inside the WebView requests to open a new window, such as through window.open().

public event EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2NewWindowRequestedEventArgs> NewWindowRequested;
member this.NewWindowRequested : EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2NewWindowRequestedEventArgs> 
Public Custom Event NewWindowRequested As EventHandler(Of CoreWebView2NewWindowRequestedEventArgs) 

Event Type

Remarks

The app can pass a target WebView that is considered the opened window or mark the event as Handled, in which case WebView2 does not open a window. If either Handled or NewWindow properties are not set, the target content will be opened on a popup window. If a deferral is not taken on the event args, scripts that resulted in the new window that are requested are blocked until the event handler returns. If a deferral is taken, then scripts are blocked until the deferral is completed.

On Hololens 2, if the NewWindow property is not set and the Handled property is not set to true, the WebView2 will navigate to the Uri. If either of these properties are set, the WebView2 will not navigate to the Uri and the the NewWindowRequested event will continue as normal.

Applies to