iPhone Web Development: Frequently Asked Questions
1. General
Q: What iPhone settings may a user change?
A: A list of most of the iPhone settings, including all of those requiring additional information, is available here.
Q: What bugs have been recorded on the iPhone?
A: A partial listing is available here:
2. Development
A: Use a view source bookmarklet.
Q: How can I debug with a JavaScript console?
A: Download Joe Hewitt's Firebug.
Q: What is the pixel size of the developer-accessible iPhone screen?
A: 320x396 with 32 depth.
See this discussion from our Google Group for more details.
2.1. Page display
Q: How do you detect if a user is on an iPhone?
A: Check the user agent.
Q: What fonts are available on the iPhone?
Q: What are examples of sites that look good on the iPhone?
A: See this section.
2.2. Viewport settings
Q: What is the default size browser the iPhone uses?
A: By default the iPhone acts as if it were a 980-pixel-wide browser.
Q: How do I make a page look the same in both landscape and portrait mode?
A: Set the maximum-scale value in your viewport tag.
2.3. iPhone events
Q: What events are available on the iPhone?
A: See this list here. Note that many events are nonfunctional, including many mouse-related events.
Q: When does “OnMouseDown” occur?
A: Immediately before “OnMouseUp”, when the finger is removed from the screen. It is thus not particularly helpful to capture.
Q: How do you determine that the iPhone has changed orientation?
Q: How do you determine when a zoom has occurred?
A: You cannot.
Q: How do you determine when a user has switched from one Safari window to another?
A: You cannot.
Q: Do events continue in a backgrounded page after you have switched to a new one?
A: No.
2.4. The chrome: the iPhone’s implicit UI
Q: How do you turn off the iPhone UI elements (the “chrome”)?
A: The top chrome disappears off the top of the screen when the page scrolls.
A web page can automatically scroll the top chrome off when it loads by executing a delayed window.scrollTo(0,1) event. There is a slight delay between the page scrolling and the chrome receding in this case. See example.
The bottom chrome is fixed in place.
Q: What is the difference between a standard tooltip and an iPhone info balloon?
A: An example of the difference can be found here.
Q: Does flick-scrolling work automatically, or must you do something special in your web apps?
A: It is automatic; nothing need be done server-side.
Q: How do you force the iPhone to pop up a specific keyboard for an input box?
A: The regular text keypad pops up by default.
Include the word “phone” in your box name to instead pull up the phone number keyboard.
Include the word “zip” in your box name to instead pull up the zip code keyboard.
There is no known way to automatically pull up the url keyboard.
See examples.
2.5. iPhone chrome emulation in webapps
Q: How do you emulate an iPhone app as a webapp?
A: View Joe Hewitt’s example.
Q: How can you emulate the bottom chrome, pinned to the bottom of the display, in a UI?
A See this example.
Q: How can that bottom chrome be updated to include icons as navigation?
A: See this example.
3. Browsing
Q: Can you browse while speaking on the cell phone?
A: You cannot use the EDGE network while you are talking on the cell phone. If you have access to a Wi-Fi network, that is still available while you are making a call.
Q: Can you upload files via the browser?
A: No.
Q: Where are bookmarks synched to?
A: On the Macintosh they are synched to Safari, and though .Mac to other Macintoshes.
Q: Is there any way to right click?
A: No.
Q: Are cookies saved on the iPhone?
A: Yes. See example here.
Q: Does the iPhone cache content?
A: Yes, though it appears to be limited.
3.1. Special URLS
Q: When does the YouTube app get launched?
A: Any YouTube.com URL will automatically launch the YouTube app unless the URL contains a “&” ... which is probably a bug.
Q: Does the iPhone support RFC 2368 extended mailto: schemes such as “?subject=unsubscribe”?
A: Yes.
4. Email Questions
Q: Can you have multiple email accounts on your iPhone?
A: Yes.
Q: How do you attach files to your email?
A: Generally, you cannot. The one exception is photographs. These can be emailed from your iPhone by selecting the “Email Photo” action from your photo album.
Q: Can you email while speaking on the cell phone?
A: Yes. If you have access to a WiFi network it will go out immediately. If you send an email while making a call and have no access to a WiFi network, it will queue up and send after the call is complete.