O'Reilly logo

PhoneGap by Andrew Lunny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Detection and fallbacks

We're going to start a new application called Red Green Refactor! Red, Green, Refactor is a phrase drawn from the Test-Driven Development, a development approach we will studiously avoid throughout this book. But it does come in handy when you can use it.

  1. Start by creating the www directory as usual, and three files: index.html, app.js, and style.css. Fill in index.html as follows:
    <!doctype html>
    <html>
        <head>
            <title>Red Green Refactor</title>
            <script src="app.js"></script>
            <link rel="stylesheet" href="style.css"/>
        </head>
        <body>
            <div class="screen" id="red">RED</div>
            <div class="screen" id="green">GREEN</div>
            <div class="screen" id="refactor">REFACTOR</div>
        </body>
    </html>
  2. And add the following to style.css ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required