Clarifying Windows Phone 8 HTML5 Apps

If you made it to build or spent much time watching the videos one of the stories many heard from Microsoft revolved about creating HTML5/JS applications for the Windows Phone 8. Unfortunately the story confused a lot of people (at least by the questions I've been getting lately.

Let me be *can* create HTML5/JS/CSS applications for Windows Phone 8. Yup. In fact, you could do it with Windows Phone 7 and 7.5. This is how PhoneGap works. The XAML page simply hosts a WebBrowser control and loads all of the assets locally in the XAP. What you can't do is create WinJS application. Let's step back a little and explain that better.

Windows 8 and Windows Phone 8 were both highly publicized releases this last week. One of the things that is not all that obvious to the casual observer is that the biggest change to Windows Phone 8 is that the underlying operating system now uses the same core as Windows RT (e.g. Windows 8 for ARM). In fact, the new phone SDK supports DirectX, C++ and creating WinRT components.  All very cool.

The problem with the big pep rally around Windows Phone 8's new inclusion of a built-in template for a HTML5 phone application is that it implies that you can write Windows 8-style JavaScript based applications. That you cannot. I heard the phrase "sharing code between Windows Phone 8 HTML5 applications and Windows 8 JavaScript applications" a few times. You can share code, but none of the UI code. You can share business logic and other non-UI specific code. Again, this isn't new.

The big benefit of Windows Phone 8's ability to create HTML5/JS application isn't in the's in the operating system: IE10. IE10 is a much more complete browser and includes support for key features that made mobile apps and site difficult including Strict Mode and Touch APIs. With that rectified, HTML5 applications on the platform are indeed easier to build and better than before, but they are not Windows 8 JavaScript applications running on the phone.

True be known, this is similar to the problem with XAML applications on the phone and in Windows 8. The stacks are very similar (and indeed you can share more code between Win8 and WinPhone8 XAML apps) but it's still building two apps.

Of course, this shouldn't be a shock because the user interface between the two devices are pretty different. Much of that has to do with the fact that the devices are very different. The metaphors are different therefore even if you could run the same app, it would need to be different between the two devices.

I love what Microsoft is doing with WinRT and Windows Phone 8, but I wish they wouldn't oversell some of it as it will just frustrate users once they learn the completely truth of the matter.


What do you think?




Rpw Monday, November 5, 2012

What's confusing to me is which type of application can I create that will work across Windows Tablet 8 and Windows Phone know, like the IPhones and Android platforms allow?
Can I use WPF for both?


Shawn Wildermuth Monday, November 5, 2012


No, sorry. There isn't a solution for that. It's more like iPhone/iPad where you would build two apps as the way you interact with apps is very different. You can share .NET code between them, but no UI code. You might also look at PhoneGap now that it supports WinPhone and WinRT.


Colin E. Monday, November 5, 2012

Hi Shawn, interesting blog post - thanks for clarifying.

Regarding iPad / iPhone - no, this is not the same. iPad and iPhone share exactly the same SDK, which makes it possible to build apps that share both logic and UI code. For the iPad you typically just change the UI layout a little.


Shawn Wildermuth Monday, November 5, 2012


Sorry, I was taking a shortcut. It's not the same. It is more difficult for WinPhone and WinRT...what I meant is that while you can build the same app for both...most people would expect to write versions for both (even with lots of shared code) as the UI experience is different.


Dan Monday, November 5, 2012

I'd like to see a break down of the Windows Phone Runtime API's accessible via JavaScript - such a shame to have to trawl through each API individually.


Kamran Wednesday, November 7, 2012

This bummed me out too; I am TOTALLY OK with creating two UI projects, but I wish I could use WinJS for both platforms as that's a good investment in Windows 8 that I can't take advantage of in WP8.

The other thing, maybe you know, is what kind of performance you'd get from a embedded browser vs. a Windows 8 WinJS app. Are embedded HTML/JS apps going to be as fluid and smooth as XAML/C# ones? Because if not, I think it basically means if you want to target Windows 8 and WP8, you're going to be writing C#/XAML for both platforms unless you want to specifically use WinJS for the UI portion of your Windows 8 app.


Shawn Wildermuth Wednesday, November 7, 2012


I tend to agree...C#/XAML if you're targetting just Win8 and WinPhone 8 but targetting iOS, Android and Blackberry using PhoneGap, using a raw HTML might be better.

Leave a Comment