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. The series is written in collaboration with Microsoft evangelist Peter Bryntesson, check out his blog 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 web feeling 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.

Templates Soulution explorer

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!

This Post Has 3 Comments

  1. Indrasheker

    I am using JavaScript Universal template for windows phone 8.1 app. Can you please let me know.. How to verify whether the internet connection is available or not using WinJS.

    var background = Windows.ApplicationModel.Background;
    var internetCondition = new background.SystemCondition(background.SystemConditionType.internetAvailable);

    If above lines can work to verify the internet connection, then let me know how to work out..


Leave a Reply