WebView.UnviewableContentIdentified Event
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
// 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" />
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;
}
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.
Product | Versies |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |