HTML WebView control sample

This sample demonstrates how to use WebView.

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

(function () {
    "use strict";

    var page = WinJS.UI.Pages.define("/html/5_InvokeScript.html", {
        ready: function (element, options) {
            // Load the contents of the sample HTML file to be displayed in the text area
            WinJS.xhr({ url: "ms-appx-web:///html/script_example.html", responseType: "text" }).done(function (request) {
                document.getElementById("htmlString").value = request.responseText;

            document.getElementById("invokeScriptButton").addEventListener("click", invokeScript, false);

    function invokeScript() {
        // Call the changeText function in the page loaded into the WebView, passing in the
        // value of the textInput field as the argument
        document.getElementById("webview").invokeScriptAsync("changeText", document.getElementById("textInput").value).start();