Update 6/30/07: We’ve added a new article in this series that has observations based on spending a day testing the iPhone in person.

As hordes of developers scramble to get web apps developed for the iPhone prior to the June 29 launch, many developers (and would-be developers) are realizing several potential interaction issues with their applications.

Multi-Touch Minefield

First and foremost: while drag and drop-style AJAX-y goodness would be ideal to interact with web apps due to economy of clicks/movement, it’s very likely that dragging and hovering won’t function as expected on the phone due to the built in scrolling/zooming gestures.

Have a look at Apple’s screen capacitance tech demo here.

What does this mean? Well, for starters, drilldown menus that work onMouseover (or CSS hover) instead of onClick probably won’t work properly.

Resolution Issues

As has been widely publicized, the iPhone’s resolution is 320×480 pixels. Based on examination of tons of PR photos and tech demos, we’ve found that the likely live browser area is 320×420 (without the address bar overlay) and 320×360 (with the address bar overlay).The topmost menubar (the one with signal strength, time and AT&T) is almost assuredly 320×20, and the bottom navigation menubar should be 320×40.Again, these are guesses based on available material at hand, but I’m reasonably certain that they’re good guesses.

So… Ajax and Javascript, but what flavors?

Another really good question. We can be reasonably certain that if a site functions properly in Safari without hover-drilling menus, it should work pretty well in the iPhone. Whether performance will be acceptable is another issue entirely, however.

Apple’s recent site redesign yields a couple of clues.

They’ve begun using the scriptaculous library really extensively for demos and menu items. If Apple just rolled out their first major site revamp in five years in anticipation of the iPhone, we can rest pretty easy about scriptaculous’s performance.

In addition, I’d wager heavily that Spry framework widgets will work well and seriously help economize browser space, however I’m hesitant about how well the animated effects will perform in-browser. Granted, there are far fewer pixels to push around on the iPhone’s screen, but we’re not using a desktop-class CPU.

Multiple Sites?

Most developers are designing a single site with two separate stylesheet layouts for actual web applications. Sure, Safari will read in any site at any resolution, but there’s something geeky about designing a stylesheet specifically for the phone to help with legibility at 100% scaling. Not to mention the positive karma.I have doubts that the media type “mobile” will affect mobile Safari’s choice of stylesheet (”it’s not the mobile internet…”), so how do we switch CSS? (update: media=”mobile” will be supported per the leaked developer’s notes.)

We know that the iPhone identity string will come up under the user agent request information, so I’ve written a quick, easy function to determine if the site’s being browsed via an iPhone.

<?php
//is_iphone function written by Trey Harrell | iPhone-geek.com
//usage:   if (is_iphone()) { echo "<link rel=\"stylesheet\" href=\"/_css/iphone.css\"
// type=\"text/css\" media=\"screen\" />"; }
function is_iphone() {
$clientagent=$_SERVER["HTTP_USER_AGENT"];
if (ereg("iPhone",$clientagent)) {
	return true;		}
else {
	return false;		}
}?>

Updated 6/19/07:

The following information recently came to light regarding Safari’s behavior on the iPhone:

Flash and Java will not be supported by Safari at launch

The device width reads as 480px, not the 320 that most developers have been assuming.

Media = “mobile” will be supported in the CSS spec

HTML5 is supported

Javascript is limited to 5 seconds’ runtime before (we assume) the process is killed in order to keep the iPhone responsive.

Quicktime will be used, and the optimized setting for video on the iPhone is H.264 baseline profile 3.0 up to 640×480.

I hope that some budding developers will find this information handy. We’ll be updating the site with the latest information as it becomes available and it will all be compiled into a single-page iPhone developer’s guide.If you have any other tips or hints, please share them in the comments below.