WebView.UnviewableContentIdentified Evento

Definición

Se produce cuando WebView intenta descargar un archivo no admitido.

// Register
event_token UnviewableContentIdentified(TypedEventHandler<WebView, WebViewUnviewableContentIdentifiedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
WebView::UnviewableContentIdentified_revoker UnviewableContentIdentified(auto_revoke_t, TypedEventHandler<WebView, WebViewUnviewableContentIdentifiedEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView,WebViewUnviewableContentIdentifiedEventArgs> UnviewableContentIdentified;
function onUnviewableContentIdentified(eventArgs) { /* Your code */ }
webView.addEventListener("unviewablecontentidentified", onUnviewableContentIdentified);
webView.removeEventListener("unviewablecontentidentified", onUnviewableContentIdentified);
- or -
webView.onunviewablecontentidentified = onUnviewableContentIdentified;
Public Custom Event UnviewableContentIdentified As TypedEventHandler(Of WebView, WebViewUnviewableContentIdentifiedEventArgs) 
<WebView UnviewableContentIdentified="eventhandler" />

Tipo de evento

Ejemplos

En el ejemplo de código siguiente se muestra cómo controlar este evento para iniciar un explorador externo cuando el control WebView no puede representar el contenido de destino. Para obtener el ejemplo completo, consulta el ejemplo de control WebView xaml.

void webViewA_UnviewableContentIdentified(WebView sender, 
    WebViewUnviewableContentIdentifiedEventArgs args)
{
    appendLog(String.Format("Content for \"{0}\" cannot be loaded into webview. " +
        "Invoking the default launcher instead.\n", args.Uri.ToString()));

    // We turn around and hand the Uri to the 
    // system launcher to launch the default handler for it.
    Windows.Foundation.IAsyncOperation<bool> b = 
        Windows.System.Launcher.LaunchUriAsync(args.Uri);
    pageIsLoading = false;
}

Comentarios

El control WebView no puede hospedar tipos de archivo arbitrarios, pero puede controlar este evento y usar la clase Launcher para redirigir el archivo al explorador u otra aplicación.

Se aplica a

Consulte también