Windows Phone 8.1 For Developers–For the HTML/Javascript Developer

This blog post is part of a series about how Windows Phone 8.1 affects developers. This blog post talks about the new and exciting possibilities for HTML/Javascript developers and is written by Alexander Persson at Jayway and was originally posted https://www.jayway.com/2014/04/14/windows-phone-8-1-for-developers-for-the-htmljavascript-developer/here.

If you are a Javascript developer and enjoy developing for Windows Phone you were limited to using C#/XAML and a WebBrowser component for loading your Html/Javascript content in Windows Phone 8.0. The solution worked but you was somehow limited by the fact that your Javascript couldn’t access the phone’s resources – you needed a C# bridge for that. You weren’t able to use the Windows Phone controls you were used to and the result had a more hybrid feel than a native.

For Windows Store apps we had support for WinJs for some time now and it has been great asset for Javascript developers. The Windows Phone 8.1 release now enables Javascript developers to develop Windows Phone apps using WinJs and take advantage of all the benefits it delivers.

If you already developed Windows Store app with WinJs you will feel comfortable developing Windows Phone apps with WinJs as they share many features. It will also be easy to share code between the two platforms.

For Javascript developers new to WinJs you will basically get a set of Windows Phone controls and API for accessing the device resources. You will have controls like AppBar, FlipView, ListView and ToggleSwitch amongst others that behaves and looks like the XAML counterpart.

With WinJs you are developing native apps without any of those limitations we had previous when we wanted to develop our app with Javascript. We get access to the phones themes and resources in a few lines of code and we can easily use components and controls users are familiar with from other Windows Phone apps.

If you are already developing apps using XAML, this is just another way to do it in another language. WinJs for Windows Phone is suited for those who already develop WinJs apps for Windows Store and wants to develop for Windows Phone as well. It also enables a great range of current Javascript developers to start developing native Windows Phone apps.

The SDK comes with two templates for Windows Phone, one for a blank app with only the basics. The other, Navigation app, has code to handle page navigation.

clip_image002

clip_image003

With this release Javascript developers on Windows Phone are now on the same level as they been when developing for Windows Store. Full access to controls and device resources enables a broad range of developers to develop native apps without using C# and XAML.

Welcome WinJs, finally we meet on the phone!