iPhone web enhancement
Notes from my talk at SHDH on improving iphone browser accessibility on regular websites:
Layout
You can use a separate stylesheet to overwrite style settings for your site:
<link rel="stylesheet" href="mobile.css" media="handheld, only screen and (max-device-width: 480px)" type="text/css" />
You almost certainly want to reset the Viewport size. By default mobile safari likes to pretend it has a 940-ish wide screen and just shrinks stuff. You can control this with:
<meta name="viewport" content="width=320" />
Allowing you to be more precise with sizing.
For layout, you're basically looking at a single column. The screen simply isn't wide enough to effectively support two columns or sidebar nav, even in the horiztonal mode. I recommend leaving the column width unspecified, that way it'll resize nicely on orientation switch.
Your mobile stylesheet may need to have some font-size tweaking, you really need to test to check that out.
Specify logo and header images etc in stylesheet, not within the HTML. This lets you replace them with smaller-size versions in the mobile stylesheet.
Typically, a small number of major functions should be buttons across or near the top. Put useless functionality at the very bottom (if at all)
Forms and buttons
Go with native controls where-ever practical, specialised selectors generally mean that your attempt at styling form controls will be partially successful at best.
A persons thumb is roughly 40x40x or worse - nothing like a mouse pointer. Control size matters
Control-misses are much much more common - don't put irritating combinations of controls together - "Save" and "Navigate away from this page and forget everything you did"
Activity-response. If you're scrolled down on the page it's entirely possible to get no feedback at all on a link click. At the very least make sure you get the link changing color with :active.
Images
Preferably, generate mobile-sized thumbnails. 3g is really slow.
Caching
iPhone has a really small cache, both on numbers of items and size. Maximum per item size is 25kb, roughly 18-19 can be used maximum. LRU replacement.
iPhone will *only* cache stuff with Expires or Cache-Control-max-age headers. If you don't set these headers, stuff will get reloaded again and again.
Cached stuff is stored *uncompressed*. sending compressed content won't help with cache size (will help with traffic though)
Minify etc are hugely valuable here if you're javascript-heavy
Javascript etc:
Mobile Safari is pretty much a full webkit implementation. There's not a lot it can't handle. Unless you're doing something really really crazy it'll probably be fine.
Flash does not work at all. Don't even bother.
Video
mpeg4, preferably encoded for iphone size - 480x320, unless it's screen linked. 640x480 is max.
Link directly to the mpeg to get the in-screen view.
Youtube is a bit weird, you may need to test things.
Separate sites
If you're doing a mobile version of your site, rather than just integrating the stylesheet, the convention is m.. Some sites automatically redirect you from the main site if you turn up with a mobile useragent, and give you a cookie-triggered option to go back to the main site (in case you want functionality not implemented on the mobile version or whatever).
Examples
m.flickr.com
Layout
You can use a separate stylesheet to overwrite style settings for your site:
<link rel="stylesheet" href="mobile.css" media="handheld, only screen and (max-device-width: 480px)" type="text/css" />
You almost certainly want to reset the Viewport size. By default mobile safari likes to pretend it has a 940-ish wide screen and just shrinks stuff. You can control this with:
<meta name="viewport" content="width=320" />
Allowing you to be more precise with sizing.
For layout, you're basically looking at a single column. The screen simply isn't wide enough to effectively support two columns or sidebar nav, even in the horiztonal mode. I recommend leaving the column width unspecified, that way it'll resize nicely on orientation switch.
Your mobile stylesheet may need to have some font-size tweaking, you really need to test to check that out.
Specify logo and header images etc in stylesheet, not within the HTML. This lets you replace them with smaller-size versions in the mobile stylesheet.
Typically, a small number of major functions should be buttons across or near the top. Put useless functionality at the very bottom (if at all)
Forms and buttons
Go with native controls where-ever practical, specialised selectors generally mean that your attempt at styling form controls will be partially successful at best.
A persons thumb is roughly 40x40x or worse - nothing like a mouse pointer. Control size matters
Control-misses are much much more common - don't put irritating combinations of controls together - "Save" and "Navigate away from this page and forget everything you did"
Activity-response. If you're scrolled down on the page it's entirely possible to get no feedback at all on a link click. At the very least make sure you get the link changing color with :active.
Images
Preferably, generate mobile-sized thumbnails. 3g is really slow.
Caching
iPhone has a really small cache, both on numbers of items and size. Maximum per item size is 25kb, roughly 18-19 can be used maximum. LRU replacement.
iPhone will *only* cache stuff with Expires or Cache-Control-max-age headers. If you don't set these headers, stuff will get reloaded again and again.
Cached stuff is stored *uncompressed*. sending compressed content won't help with cache size (will help with traffic though)
Minify etc are hugely valuable here if you're javascript-heavy
Javascript etc:
Mobile Safari is pretty much a full webkit implementation. There's not a lot it can't handle. Unless you're doing something really really crazy it'll probably be fine.
Flash does not work at all. Don't even bother.
Video
mpeg4, preferably encoded for iphone size - 480x320, unless it's screen linked. 640x480 is max.
Link directly to the mpeg to get the in-screen view.
Youtube is a bit weird, you may need to test things.
Separate sites
If you're doing a mobile version of your site, rather than just integrating the stylesheet, the convention is m.
Examples
m.flickr.com