Posted by : Sudhir Chekuri Thursday, 26 September 2013


WebView control in HTML5 javascript windows store apps is used to display a webpage on the app.

It is same like iframe control but it is having some new features which iframe doesn't have they are as follows:
It is far more compatible, No more frame busting, Independent navigation stack, navigateToString.

It is like a browser running inside an app which is having its own navigation stack.
You can send some html code from a string as a source to webview control.

Html code

 <x-ms-webview src="http://codefoster.com" height="1000" width="1000"></x-ms-webview>

This is used to display codefoster.com website home page in a control inside store app.

You can also give source as html content in string from to display it as web content in webview control using the below html5 and javascript code.

Html code of webview control

 <x-ms-webview ></x-ms-webview>


javascript code to give source for webview control
(function () {
    "use strict";

    WinJS.UI.Pages.define("/pages/home/home.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
   
            element.querySelector("x-ms-webview").navigateToString("This is an <b>arbitrary</b> HTML string that I can navigate my WebView to.");

        }
    });
 
})();




Leave a Reply

Subscribe to Posts | Subscribe to Comments

Followers

Total Pageviews

Powered by Blogger.

Blog Archive

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -