Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.88 KB

webview_unviewablecontentidentified.md

File metadata and controls

46 lines (33 loc) · 1.88 KB
-api-id -api-type
E:Windows.UI.Xaml.Controls.WebView.UnviewableContentIdentified
winrt event

Windows.UI.Xaml.Controls.WebView.UnviewableContentIdentified

-description

Occurs when the WebView attempts to download an unsupported file.

-xaml-syntax

<WebView UnviewableContentIdentified="eventhandler" />

-remarks

The WebView control cannot host arbitrary file types, but you can handle this event and use the Launcher class to redirect the file to the browser or another app.

-examples

The following code example demonstrates how to handle this event to launch an external browser when the WebView control cannot render the target content. For the complete example, see the XAML WebView control sample.

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;
}

-see-also

WebViewUnviewableContentIdentifiedEventArgs, Launcher, XAML WebView control sample