다음을 통해 공유


CoreWebView2NewWindowRequestedEventArgs.NewWindow Property

Definition

Gets the new window or sets a WebView as a result of the new window requested.

public Microsoft.Web.WebView2.Core.CoreWebView2 NewWindow { get; set; }
member this.NewWindow : Microsoft.Web.WebView2.Core.CoreWebView2 with get, set
Public Property NewWindow As CoreWebView2

Property Value

Remarks

Provides a WebView as the target for a window.open() from inside the requesting WebView. If this is set, the top-level window of this WebView is returned as the opened WindowProxy to the opener script. If this is not set, then Handled is checked to determine behavior for the NewWindowRequested. The methods which should affect the new web contents like AddScriptToExecuteOnDocumentCreatedAsync(String) has to be called and completed before setting NewWindow. Other methods which should affect the new web contents like WebResourceRequested have to be called after setting NewWindow. It is best not to use RemoveScriptToExecuteOnDocumentCreated(String) before setting NewWindow, otherwise it may not work for later added scripts. WebView provided in the NewWindow property must be on the same CoreWebView2Environment as the opener WebView and cannot be navigated. Changes to settings should be made before setting NewWindow to ensure that those settings take effect for the newly setup WebView. The new WebView must have the same profile as the opener WebView.

Applies to