ICoreWebView2NewWindowRequestedEventArgs.put_NewWindow

Sets a CoreWebView2 as a result of the NewWindowRequested event. 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 NewWindowRequested event. CoreWebView2 provided in the NewWindow property must be on the same Environment as the opener WebView and should not have been navigated previously. Don't use methods that cause navigation or interact with the DOM on this CoreWebView2 until the target content has loaded. Setting event handlers, changing Settings properties, or other methods are fine to call. Changes to settings should be made before put_NewWindow is called to ensure that those settings take effect for the newly setup WebView. Once the NewWindow is set the underlying web contents of this CoreWebView2 will be replaced and navigated as appropriate for the new window. After setting new window it cannot be changed and error will be return otherwise.

The methods which should affect the new web contents like AddScriptToExecuteOnDocumentCreated has to be called and completed before setting NewWindow. Other methods which should affect the new web contents like add_WebResourceRequested have to be called after setting NewWindow. It is best not to use RemoveScriptToExecuteOnDocumentCreated before setting NewWindow, otherwise it may not work for later added scripts.

The new WebView must have the same profile as the opener WebView.

interface ICoreWebView2NewWindowRequestedEventArgs
@" propput"
HRESULT
put_NewWindow

Meta