Download Learn HTML5 and JavaScript for iOS by Scott Preston easily in PDF format for free.

Congratulations! You are building your first web application for your iOS device (iPhone, iPad, or iPod Touch) using HTML5 and JavaScript. You might think that you can pick up one of your HTML or JavaScript books from years past and then just scale it down to the size of your target device and you’ll be good to go. You’d be wrong. A lot has changed. In this chapter we lay the groundwork for building a mobile web app

Here we cover things like getting familiar with your browser, setting up your mobile project, architecting the site, and creating a site map as well as selecting the tools you’ll use to build it. All you need is an idea, and I’ll help you take care of the rest. You purchased this book to get started building a mobile web app. I won’t beat around the bush and tell you about the history of the Internet or the history of browsers.

Instead, let’s just jump in. Before embarking on a mobile project, you need to have certain things in place, which I’ll talk about next. If you’re a seasoned web developer you probably know all of this stuff and can skip ahead; otherwise, keep in mind this is just an overview. If you have detailed questions, you can ask me via my site: First, I’ll talk about setting up your environment.
Local Environment Fortunately, OS X comes with Apache built in. To enable Apache to work with your site, go to System Preferences Sharing, and then enable Apache by clicking on the Web Sharing box, as shown in Figure 1-3. You now have an Apache web server serving content from /Users/{username}/Sites. If you don’t have a web host for your site, you’ll eventually need to get one. You have plenty to choose from.

In the past I’ve had good luck with Host Gator ( You can get a site there starting at around $4 per month for Linux hosting. Bug and Feature Tracking Your site will not be perfect at launch, and you’ll want to add features to it over time. For this, I’d recommend a ticketing and feature-tracking system. Every project needs version control software and there are two main version control systems out there.

Basically, the two version control systems do the same thing they keep track of your code: Subversion (SVN) keeps track of all your code in a single repository or server. SVN has been around a lot longer than Git (the other option), there’s more documentation, and it’s a little easier to learn and understand. You can find free online SVN providers including and