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/
Eric Shepherd (November 1, 2007 at 10:06 am)
That all sounds very interesting. I’ve been using mobile Safari for a while on my iPod touch now, and it’s actually quite impressive what they’ve managed to make a mobile browser do. There are some good lessons for us there.
I would very much like to see a unified architecture for bookmark syncing; it’s quite frustrating not being able to sync my bookmarks from Firefox to Safari mobile. Hopefully something comes of that!
Ryan (November 1, 2007 at 12:52 pm)
Neat stuff. I haven’t kept up to date on iPhone stuff, window.onorientationchange is new to me.
The Javascript hating is pretty common for anyone who’s never done web development. There really needs to be some work done by well-known programmers in the traditional desktop app field to show people that Javascript is a real language and you don’t need GWT for everything.
Dan Croak (November 1, 2007 at 6:46 pm)
Great summary. Thanks, John. I’m particularly interested in their decision to not support Flash. That, to me, has seemed the one thing most glaringly missing on various sites viewed via iPhone’s Safari. Was that decision mostly driven by “playing up” web standards or a function of how the Flash plugin needed to be implemented (or security issues with Flash … I seem to remember stories about people attacking MySpace with Flash)?
+1 on Eric’s call for a unified bookmark syncing architecture.
Chris Griego (November 1, 2007 at 7:29 pm)
“There are no multiple selects. All multiple selects are just treated as single selects.” More specifically, multiple selects still function as multiple selects, but when shown within the page content, they appear as tall as a single select.
John Resig (November 2, 2007 at 12:58 am)
@Eric & Dan: I’m pinging my Apple contacts to see if I can find out more.
@Ryan: That might be tricky – we have to get those app developers to see the light first ;-)
@Dan: I almost wonder if it was a logistical play by them – not wanting to burden it with any additional 3rd-party code.
@Chris: I was under the impression that when the select popped up you could only then select one item. Hmm, I’ll have to do more testing.
Dave Savage (November 2, 2007 at 12:00 pm)
Very cool stuff John. The whole notion of controlling zoom sizes is really quite interesting. I am still wondering how long until it is main-stream.
cc (November 4, 2007 at 12:36 am)
Um – I went to an iPhone Tech Talk, but was told the content was covered by an NDA. Was this not the case in Boston?
John Resig (November 4, 2007 at 1:34 am)
@cc: I didn’t sign an NDA – did you? Everything that I covered is also discussed on their web site (plus I’ve pinged people at Apple and they don’t seem to mind).
Poncho (November 4, 2007 at 7:27 am)
@Ryan & John: Photoshop CS3 is a good example of a desktop application using javascript in a big way, in fact I think the entire CS3 suite is scriptable.
Cheers;
Poncho
John Resig (November 4, 2007 at 7:56 pm)
@Poncho: Very good point! I assume that they’re probably using an ActionScript derivative?
Daniel Pihlström (November 5, 2007 at 5:21 am)
Adobe’s JavaScript implementation is called ExtendScript, which is an extension upon Mozilla’s JavaScript code (from a version back in ’98 when ExtendScript was ‘born’). You can really do practically anything in Photoshop using it, unfortunately it’s not a paricularly well-known feature.. So most people who would have any use of it don’t know it even exists. :)
It would be nice to see more application developers come to terms with JavaScript no longer being those things they used to download off dynamicdrive to make clocks appear next to their cursors on the intranet, but I have a hard time seeing that happening.
Nice to see some information about what the Apple folk are up to, I have a hard time keeping track of anything from them..!
Remy Sharp (November 7, 2007 at 7:28 pm)
Something I’ve noticed playing with mobile Safari (not iPhone, but iPod Touch – but assuming they’re the same) – the css style ‘overflow’ is not supported. In fact, the overflowed content is entirely hidden (see example: http://leftlogic.com/demo/overflow.html).
I can only assume this is because the user is scrolling/moving the entire loaded page and it can’t support bidirectional scrolling on any subsequent elements.
Muthu (December 3, 2007 at 11:43 am)
I developed a small portal with this basic layout schema using ASP.NET. It’s quite impressive. I am not a UI guy. But the way, i was able to get this rendered in iPhone was easy and i liked it. URL: http://www.sendvite.com/.
Victor (December 22, 2007 at 1:02 pm)
Remy you are right the overflow property is not currently working on the iphone/safari