iPhone Tech Talk


The other week I went to the Boston iPhone Tech Talk and took a bunch of notes. I thought everyone would be interested in what they had to say as its quite relevant to Mozilla’s upcoming mobile efforts, and the browser space in general. Let me know if anything needs any, additional, clarification.

Notes:

There was a lot of JavaScript hate by attendees (“blah blah… GWT is the only thing we trust… blah blah JavaScript is a stupid language…”). Not really surprised. Generally, these are Mac application developers by trade and the Open Web, by comparison, is frustrating and limiting.

There was strong promotion of web standards, down play of plugin (Flash, Silverlight, Java Applets) dependencies.

They recommended optimizing your page according to the following points: Scales for readability, minimize pan/zoom, finger friendly, and tuned for wireless. That translates to: Use clear type and logical page layout, reduce the height or width of the page to better fit within the screen, make your links and inputs large (to handle the large “mouse pointer”), and make liberal use of caching and gzip. All of these are good points to encourage within the web, in general.

Pages that are marked up with XHTML Mobile or are on a .mobi domain are handled specially (they’re shown unmodified – assuming that the developer has already optimized the page for a mobile device appropriately).

There are some, very interesting, limitations to pages; and the browser, in general. For the most part this shouldn’t effect many sites (especially considering that plugins don’t run). I’ve noted the JavaScript-related ones:

  • 10 MB JavaScript object allocation
  • 5 second JavaScript execution limit
  • XHR not counted to JavaScript execution time (async or sync)
  • Scripts may be paused (Inactive window, Safari not active)
  • Scripts are not paused while a Quicktime movie is playing
  • Maximum 8 windows open at a time

I found it to be interesting that JavaScript execution was pausable. Thus, if have a game running in one window and go to another, the game (presumably, written in JavaScript) will be paused until you come back to it. This model is akin to what they currently do with Dashboard widgets (which are, also, HTML/CSS/JS and are paused until you view them).

It’s important to note that, not only, are you not able to have more than 8 windows open at a time, but you don’t have control over windows that you open. There is no such thing as a popup or modal dialog. Nor are there tabs to browse through the open windows (You have to navigate to a separate view where you browse thumbnail views of the sites). I’ve been trying to decide if this is more-tabbed-like or less-tabbed-like because of how it’s designed (e.g. one could argue that having modal popups breaks the tabbed model), whereas not actually having access to tabs (or information about the tabs that you open) is very limiting.

Only three dialogs are allowed: alert, confirm, and prompt. They are all highly styled and consume a large portion of the screen when they appear.

Interacting with form controls is highly unique. When you do so you are placed into a separate editing/manipulation mode laid on top of the browser itself. This is indicative of the larger theme in the browser: They consistently push the user into a separate pane to deal with specialized content. I think that this is an incredibly interesting development and – quite possibly – an optimal way of dealing with “non-native” browser content.

For example, Excel, Word, PDF, and Quicktime content are all handled natively by the browser – and are shown in separate, specialized, views. (Videos are especially interesting – the whole browser is hidden and is replaced with a completely-tailored UI that is optimized for viewing movies.) I was hugely impressed by this set of features and I really think that this is a huge step for a browser to take. Mozilla is starting to do this with the new video tag, but providing means for handling common documents might be interesting as well.

They include a fully standards compliant version of Canvas – they recommend using it, highly. In fact, they recommend using things like border-image, border-radius, and Canvas to remove the need for extra markup or images.

There is no way to completely emulate the iPhone outside of the iPhone itself (e.g. no desktop iPhone browser – even though there’s Webkit/Safari – it’s not completely the same).

Webkit’s new Element Inspector is very, very, nice. Heavily inspired by Firebug, but with the trademark Apple UI touch. They have a CSS/Stylesheet browser (like Firebug) but they also include the default User Agent Stylesheet (which is immensely useful).

To allow the user to have control over page scaling they define a custom meta name/content that you can use:

<meta name='viewport' content='width=320'/>

The possible values for it are as follows:

  • width=320 (how wide to start the viewport at)
  • initial-scale=1 (default dimensions)
  • minimum/maximum-scale (limits user/auto scaling)
  • user-scalable=yes/no (Allows/prevents zooming via double-taps)

When the user zooms in on a portion of the page, you can adjust how large/small the font size should become with a custom CSS property:

-webkit-text-size-adjust: none
  • none (font size doesn’t grow larger)
  • auto (the text grows larger)
  • 200%, the text grows even larger

They also publish their own, custom, event and window property to let the user know about the orientation to which the iPhone is rotated, it can be used like so:

window.onorientationchange = function(){
	// 0=portrait, 90=landscape counter clockwise, 
	// -90=landscape clockwise, 180=upside down
	if ( window.orientation == 0 ) {
		// ...
	}
}

Some additional limitations that were discussed:

  • There is no concept of hovering (or, really, mouse move events in general – drag/drap isn’t possible).
  • There are no multiple selects. All multiple selects are just treated as single selects.
  • There is no way to detect which type of connection that you’re on (Edge vs. Wireless) and to serve content based upon it. The one catch is that you’re able to do it with Quicktime (serving different types of movies) but not with normal web content.

Finally, they’re very interested in getting a public sync schema for bookmarks – one that works across all browsers (easily synchronizing Firefox with Safari with iPhone Safari, etc.). Apparently they’ve contacted Mozilla in the past about this, but I’m not sure to what end this has led.

More information about developing for the iPhone can be found on Apple’s web site: http://developer.apple.com/iphone/devcenter/

Posted: November 1st, 2007


If you particularly enjoy my work, I appreciate donations given with Gittip.

14 Comments (Show Comments)



Comments are closed.
Comments are automatically turned off two weeks after the original post. If you have a question concerning the content of this post, please feel free to contact me.


Secrets of the JavaScript Ninja

Secrets of the JS Ninja

Secret techniques of top JavaScript programmers. Published by Manning.

Ukiyo-e Database and Search

Ukiyo-e.org

Japanese woodblock print database and search engine.


John Resig Twitter Updates

@jeresig

Infrequent, short, updates and links.