HTML WebView control sample

This sample demonstrates how to use WebView.

3.7 Star
5,226 times
Add to favorites
E-mail Twitter Digg Facebook
Copyright (c) Microsoft Corporation. All rights reserved

<!DOCTYPE html>
<html xmlns="">
    <title>Scenario 6: Using ScriptNotify</title>
    <link rel="stylesheet" href="/css/6_ScriptNotify.css" />
    <script src="/js/6_ScriptNotify.js"></script>
    <div data-win-control="SdkSample.ScenarioInput">
        <p>Sometimes you need to provide data back to the application from the WebView. A good example of this is when you call a script that needs to send back a return value. To do this, you handle the ScriptNotify event in the app, and then in the script, you use window.external.notify("return value"), where "return value" is the data that you want to pass back.</p>
        <p>Scripts loaded into the WebView via the NavigateToString method are allowed to send results back via the ScriptNotify event. Scripts loaded via the Navigate method are only allowed to notify the host if it's an ms-appx-web URL, an ms-local-stream URL, or a URL that's included in the ApplicationContentUris section of the package manifest.</p>
        <p>In the output below, the HTML shown on the left side is loaded into a WebView control. When the ScriptNotify event is processed, a message will appear on the right side. Click the "Reload" button to reload the HTML and trigger another ScriptNotify event.</p>
        <button id="reloadButton">Reload</button>
    <div data-win-control="SdkSample.ScenarioOutput" id="outputContainer">
        <div id="scenario6_left">
            <textarea id="htmlString" readonly="readonly"></textarea>
        <div id="scenario6_right">
            <textarea id="outputArea" readonly="readonly"></textarea>
        <div id="scenario6_hidden">
            <x-ms-webview id="webview"></x-ms-webview>