Share via


WebView.UnsupportedUriSchemeIdentified 事件

定義

發生于嘗試使用 WebView 不支援的配置流覽至統一資源識別項 (URI) 時。

// Register
event_token UnsupportedUriSchemeIdentified(TypedEventHandler<WebView, WebViewUnsupportedUriSchemeIdentifiedEventArgs const&> const& handler) const;

// Revoke with event_token
void UnsupportedUriSchemeIdentified(event_token const* cookie) const;

// Revoke with event_revoker
WebView::UnsupportedUriSchemeIdentified_revoker UnsupportedUriSchemeIdentified(auto_revoke_t, TypedEventHandler<WebView, WebViewUnsupportedUriSchemeIdentifiedEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView,WebViewUnsupportedUriSchemeIdentifiedEventArgs> UnsupportedUriSchemeIdentified;
function onUnsupportedUriSchemeIdentified(eventArgs) { /* Your code */ }
webView.addEventListener("unsupportedurischemeidentified", onUnsupportedUriSchemeIdentified);
webView.removeEventListener("unsupportedurischemeidentified", onUnsupportedUriSchemeIdentified);
- or -
webView.onunsupportedurischemeidentified = onUnsupportedUriSchemeIdentified;
Public Custom Event UnsupportedUriSchemeIdentified As TypedEventHandler(Of WebView, WebViewUnsupportedUriSchemeIdentifiedEventArgs) 
<WebView UnsupportedUriSchemeIdentified="eventhandler"/>

事件類型

範例

<WebView x:Name="myWebView" UnsupportedUriSchemeIdentified="OnUnsupportedUriSchemeIdentified" /> 
private void OnUnsupportedUriSchemeIdentified (WebView sender, WebViewUnsupportedUriSchemeIdentifiedEventArgs e) 
{ 
    // Block all URIs from invoking other apps except the mailto: protocol. 
    if (e.Uri.Scheme != "mailto") 
    { 
        e.Handled= true; 
    } 
} 

備註

請參閱 WebViewUnsupportedUriSchemeIdentifiedEventArgs

WebView 支援使用下列配置流覽至統一資源識別項 (URI) :HTTP、HTTPs、ms-appx-web、ms-appdata 和 ms-local-stream。

如果嘗試流覽至統一資源識別項 (URI) WebView 不支援,則會封鎖流覽。 根據預設,當遇到不支援的統一資源識別元 (URI) 配置時,會叫用啟動器來尋找統一資源識別項 (URI) 配置的預設提供者。 您可以處理 UnsupportedUriSchemeIdentified 事件,以決定如何處理不支援的統一資源識別元 (URI) 配置。 如果您不執行任何動作,則會叫用啟動器。 如果您為統一資源識別項 (URI) 配置提供自訂處理,請將 Handled 屬性設定為 true,以防止叫用統一資源識別項 (URI 的預設提供者) 配置。

適用於

另請參閱