ICoreWebView2_18.add_LaunchingExternalUriScheme

Add an event handler for the LaunchingExternalUriScheme event. The LaunchingExternalUriScheme event is raised when a navigation request is made to a URI scheme that is registered with the OS. The LaunchingExternalUriScheme event handler may suppress the default dialog or replace the default dialog with a custom dialog.

If a deferral is not taken on the event args, the external URI scheme launch is blocked until the event handler returns. If a deferral is taken, the external URI scheme launch is blocked until the deferral is completed. The host also has the option to cancel the URI scheme launch.

The NavigationStarting and NavigationCompleted events will be raised, regardless of whether the Cancel property is set to TRUE or FALSE. The NavigationCompleted event will be raised with the IsSuccess property set to FALSE and the WebErrorStatus property set to ConnectionAborted regardless of whether the host sets the Cancel property on the ICoreWebView2LaunchingExternalUriSchemeEventArgs. The SourceChanged, ContentLoading, and HistoryChanged events will not be raised for this navigation to the external URI scheme regardless of the Cancel property. The LaunchingExternalUriScheme event will be raised after the NavigationStarting event and before the NavigationCompleted event. The default CoreWebView2Settings will also be updated upon navigation to an external URI scheme. If a setting on the CoreWebView2Settings interface has been changed, navigating to an external URI scheme will trigger the CoreWebView2Settings to update.

The WebView2 may not display the default dialog based on user settings, browser settings, and whether the origin is determined as a [trustworthy origin](https://w3c.github.io/webappsec-secure-contexts# potentially-trustworthy-origin); however, the event will still be raised.

If the request is initiated by a cross-origin frame without a user gesture, the request will be blocked and the LaunchingExternalUriScheme event will not be raised. \snippet SettingsComponent.cpp ToggleLaunchingExternalUriScheme

interface ICoreWebView2_18
HRESULT
add_LaunchingExternalUriScheme

Meta