共用方式為


interface ICoreWebView2LaunchingExternalUriSchemeEventArgs

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

interface ICoreWebView2LaunchingExternalUriSchemeEventArgs
  : public IUnknown

Event args for LaunchingExternalUriScheme event.

Summary

Members Descriptions
get_Cancel The event handler may set this property to TRUE to cancel the external URI scheme launch.
get_InitiatingOrigin The origin initiating the external URI scheme launch.
get_IsUserInitiated TRUE when the external URI scheme request was initiated through a user gesture.
get_Uri The URI with the external URI scheme to be launched.
GetDeferral Returns an ICoreWebView2Deferral object.
put_Cancel Sets the Cancel property.

Applies to

Product Introduced
WebView2 Win32 1.0.1823.32
WebView2 Win32 Prerelease 1.0.1905

Members

get_Cancel

The event handler may set this property to TRUE to cancel the external URI scheme launch.

public HRESULT get_Cancel(BOOL * value)

If set to TRUE, the external URI scheme will not be launched, and the default dialog is not displayed. This property can be used to replace the normal handling of launching an external URI scheme. The initial value of the Cancel property is FALSE.

get_InitiatingOrigin

The origin initiating the external URI scheme launch.

public HRESULT get_InitiatingOrigin(LPWSTR * value)

The origin will be an empty string if the request is initiated by calling CoreWebView2.Navigate on the external URI scheme. If a script initiates the navigation, the InitiatingOrigin will be the top-level document's Source, for example, if window.location is set to "calculator://", the InitiatingOrigin will be set to calculator://. If the request is initiated from a child frame, the InitiatingOrigin will be the source of that child frame. If the InitiatingOrigin is opaque, the InitiatingOrigin reported in the event args will be its precursor origin. The precursor origin is the origin that created the opaque origin. For example, if a frame on example.com opens a subframe with a different opaque origin, the subframe's precursor origin is example.com.

get_IsUserInitiated

TRUE when the external URI scheme request was initiated through a user gesture.

public HRESULT get_IsUserInitiated(BOOL * value)

Note

Being initiated through a user gesture does not mean that user intended to access the associated resource.

get_Uri

The URI with the external URI scheme to be launched.

public HRESULT get_Uri(LPWSTR * value)

GetDeferral

Returns an ICoreWebView2Deferral object.

public HRESULT GetDeferral(ICoreWebView2Deferral ** value)

Use this operation to complete the event at a later time.

put_Cancel

Sets the Cancel property.

public HRESULT put_Cancel(BOOL value)