Windows 8 Platform Guide

Windows 8 Platform Guide

This guide describes how to set up your Cordova development environment and run a sample application. Note that Cordova used to be called PhoneGap, so some of the sites still use the old PhoneGap name.

Microsoft deprecated the name Metro-style apps in Windows 8 and Windows RT. MSDN now refers to this type of app as a Windows Store app, and this guide follows that convention. Also, in this guide Windows 8 signifies both Windows 8 and Windows RT.

1. Requirements

Follow the instructions here to submit your apps Windows Store.

2. Install SDK + Cordova

3. Set up New Project

You can already build Windows 8 apps using the HTML/JavaScript track available in Windows Store apps. Use Cordova in Windows Store apps to expose the same APIs as on other Cordova-supported platforms.

Adding the reference...

    <!-- WinJS references -->
    <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
    <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>

    <!-- Cordova -->
    <script src="/js/cordova.js"></script>

    <!-- CordovaWin8Foo references -->
    <link href="/css/default.css" rel="stylesheet" />
    <script src="/js/default.js"></script>

Adding a 'deviceready' handler...

<body>
    <p>Content goes here</p>

    <script type="text/javascript">

        console.log("Subscribing...");
        document.addEventListener("deviceready", function () {

            navigator.notification.alert("The device is ready!");

        });

    </script>

</body>

5. Test the Project

Done!

That's it! You're now ready to build Windows Store apps with Cordova.