Safari and Webkit Development for iPhone OS 3.0

Developing for the Mobile Web the Webkit Way.
When Apple initially announced that developers would be limited to writing web applications for the iPhone, there was a predictable disappointment from developers. At the same time, Apple eventually relented and allowed developers access to the OS, the growing number of capable — and not only iPhone — mobile browsers means that today creating a mobile website makes more sense every day. While this book naturally focuses exclusively on the iPhone, much of the material related to optimization, HTML5 and CSS3 is very applicable to the growing number of WebKit-based mobile browsers as well as desktop browsers like Safari and Chrome.

“Safari and WebKit Development for iPhone” provides an excellent introduction to developing web applications for the iPhone by showing how to use web toolkits to mimic the look and feel of native apps, how to make use of the features of CSS3 and HTML5 implemented by the browser and how to convert and optimize an existing site for the iPhone. As well as these, there are also chapters on integrating with (and that limits of) the rest of the iPhone OS.

To sum up the intended reader, I’d say the book itself is aimed at Mac users — there is, unsurprisingly, only much more complete tools for iPhone development on that Mac at this point — with some understanding of JavaScript. The book’s second chapter does have a brief introduction to JavaScript and manipulating the DOM. Still, while I can’t see it teaching someone new to javascript enough to get through this book, it is useful for those of us who have been spoiled by jQuery and have forgotten how to do DOM manipulation without the aid of such helper libraries. As readers work with the toolkits available, some Javascript knowledge is required.

See also  Create Great iPhone Photos

Web Toolkits

That chapter is followed by an introduction to three web toolkits that aim to make it easy to create web applications that look like regular iPhone applications. There is a good reason for that, and a quote from chapter 4 sums it up well: “the biggest mindset change for developers is to grasp that they are creating iPhone Web apps, not Web applications that run on iPhone.” (page 97)  Simply put, outside of games iPhone users expect the same look and feel from any application, hence the need for these toolkits, including the three profiled in the book: iWebKit, iUI and UiUIKit. Of the three, iWebKit seems to be the most powerful and is used in most of the book. Each of these toolkits uses the features of CSS3 and HTML5 to mimic the look of native apps.


One of the most useful things about this book is its coverage of HTML5 and CSS3 as it is implemented on WebKit/iPhone. Both CSS3 and HTML5 are developing standards that offer a lot of features to developers ranging from more control over presentation and video support to off-line storage. The book devotes a lot of space to demonstrating what can be done with them. In particular, the <canvas> element’s features are explained a lot, but new CSS features for images are also covered. HTML5’s support for off-line content is also covered. If there’s a weak section, it’s the coverage of using SQLite from JavaScript.


Chapter 13 provides several good general ways to optimize your iPhone app using CSS and JavaScript. Because the iPhone’s WebKit browser is much closer in capabilities to desktop browsers, most of these tips will be familiar to web developers who sites like Yahoo!’s Exceptional Performance while some, mainly to do with memory usage and speed is more relevant to the iPhone. One of the interesting points is the author makes a point about how optimizing a site as much as possible (he calls these people hyper-optimizers) can lead a large amount of work not resulting in a significant gain in performance. I’d add a point to that designers should keep in mind that with a platform that is being improved roughly once a year, it makes sense to learn how to write tighter JavaScript, figure out how to make the most of CSS’ abilities, in short, optimize with language, not the hardware.

See also  The Art of Assembly Language

Perhaps the most useful chapter for web developers with an existing website is chapter 12. This covers a few ways you can convert an existing website into something more iPhone-friendly and might make a good starting point for organizations looking take their existing website into the world of mobile devices without committing to a full re-design.


“Safari and WebKit Development for iPhone” teaches readers how to use three web toolkits available to create iPhone-friendly websites, provides a good introduction to the features of HTML5 and CSS3 as implemented in the iPhone’s browser, as well as how to convent and optimize websites for the iPhone. The best features of this book are the coverage of HTML5 and CSS3 as it applies to the iPhone and the use of toolkits for creating iPhone Apps. As well, if you have an existing website, this book will provide a fair amount of help, especially in areas where the iPhone’s browser differs from its desktop cousins.