Software development

Metro on Windows 8 with “Native HTML5”

Metro, Windows 8, Microsoft

With the Consumer Preview launch of Windows 8, Microsoft has clearly indicated its chosen path of Metro. Ironically, the end of windowed applications appears to be nigh. While it is still possible to make traditional applications as well, we are witnessing a rush of these desktop apps that behave closer to those found in the mobile world. Metro apps, for instance, open in full screen, have negligible system privileges, and can only be installed from the Store.

As usual, there is a variety of technologies to choose from when creating native applications for Windows 8. When developing Metro apps specifically, there is a newcomer amongst the more traditional technologies: HTML5. It is not a mere half baked attempt to make the platform sound trendy, either. Microsoft is making a serious effort while hopping onto the bandwagon of the cool kids.

How they have made it happen in practice is by exposing a set of Windows Runtime system APIs to JavaScript and throwing in a couple of platform specific features. The apps themselves run in the Internet Explorer 10 engine, which supports most of the things you would ever need - and then some. Don’t hold your breath for WebGL, though.

The experience for a seasoned web developer is quite good, especially if you are already using a Windows machine. If not, you may encounter some issues, such as being effectively forced to use Visual Studio to build and run your app. It is, however, quite a reasonable requirement since you would need a Windows 8 target machine in any case to try out your code.

The main problem with the setup is unit testing - or rather, the lack of it. There is currently no proposed solution for running your tests against the real platform. You will have to rely on mocking the Windows Runtime APIs and hoping they work as you expect. This is unfortunate, but reality for now.

There are a number of other surprises, such as custom CSS media queries and the absence of the “alert” function, but overall no dramatic ones. It is perhaps as close to HTML5 as you can get while taking platform needs into consideration; even the operating system settings flyout is a div element.

The future of the Metro platform looks bright. The excellent UI design aside, Microsoft has taken a steep turn away from enforcing their proprietary technologies for developing anything at all. Hopefully this will serve as an example for the whole industry.

In short: If you know HTML5, building native Windows 8 apps should not require a lot of effort.