One of the most important features in Windows 8.1 Preview for HTML/JS developers is the x-ms-webview element that’s added to HTML. If you’ve never developed in XAML before, the webview is a control that renders arbitrary HTML, CSS, and JavaScript, and allows for the app to invoke script within the webview and the webview to raise events to the app. Yes, you could do some of this with the iframe element in Windows 8, of course, but the iframe had a number of limitations. For example, if the site you wanted to host contained frame-busting code, you were simply out of luck. HTML/JS apps also lacked a way to load up downloaded or locally-generated HTML/CSS/JS into an iframe. It’s also not possible to render an iframe to a bitmap.

Fortunately, you can do all this with the webview, as well as hook into an app-provided link resolver for cases where references within the HTML need to be patched up at runtime (as when referenced images aren’t directly on the file system).

I’ll let you learn more about the webview yourself. I already wrote a bunch about it in the first preview of Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, specifically Chapter 4.

You can also learn more from John Hazen’s talk at //build 2013 which we just presented last week: Webview: bringing the web to your app.


3 Comments

  1. Posted July 3, 2013 at 3:14 pm | Permalink

    “If you’ve never developed in XAML before, the webview is a control that renders arbitrary HTML, CSS, and JavaScript…”

    What is webview if you *have* developed in XAML before?

  2. Posted July 4, 2013 at 4:38 pm | Permalink

    This is really excellent and fills several critical functional gaps we had due to heavy iframe same domain lockdown, eg can’t navigate history or scroll / zoom using parent element code. I did play with WebView in the Win8 preview but it did less than an iFrame at that point. Thanks for highlighting.