共用方式為


interface ICoreWebView2PermissionRequestedEventArgs

interface ICoreWebView2PermissionRequestedEventArgs
  : public IUnknown

Event args for the PermissionRequested event.

Summary

Members Descriptions
get_IsUserInitiated TRUE when the permission request was initiated through a user gesture.
get_PermissionKind The type of the permission that is requested.
get_State The status of a permission request, (for example is the request is granted).
get_Uri The origin of the web content that requests the permission.
GetDeferral Gets an ICoreWebView2Deferral object.
put_State Sets the State property.

Applies to

Product Introduced
WebView2 Win32 0.9.430
WebView2 Win32 Prerelease 0.9.488

Members

get_IsUserInitiated

TRUE when the permission request was initiated through a user gesture.

public HRESULT get_IsUserInitiated(BOOL * isUserInitiated)

Note

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

get_PermissionKind

The type of the permission that is requested.

public HRESULT get_PermissionKind(COREWEBVIEW2_PERMISSION_KIND * permissionKind)

get_State

The status of a permission request, (for example is the request is granted).

public HRESULT get_State(COREWEBVIEW2_PERMISSION_STATE * state)

The default value is COREWEBVIEW2_PERMISSION_STATE_DEFAULT.

get_Uri

The origin of the web content that requests the permission.

public HRESULT get_Uri(LPWSTR * uri)

The caller must free the returned string with CoTaskMemFree. See API Conventions.

GetDeferral

Gets an ICoreWebView2Deferral object.

public HRESULT GetDeferral(ICoreWebView2Deferral ** deferral)

Use the deferral object to make the permission decision at a later time. The deferral only applies to the current request, and does not prevent the PermissionRequested event from getting raised for new requests. However, for some permission kinds the WebView will avoid creating a new request if there is a pending request of the same kind.

put_State

Sets the State property.

public HRESULT put_State(COREWEBVIEW2_PERMISSION_STATE state)