« Has the Revolution Started Yet? | Main

Apple iPhone Device Detection

If you are doing mobile device/browser detection on your web/app server, how should you be treating the iPhone? Well, first off here is what the User-Agent for the iPhone looks like:

Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

For statistics purposed you might want to be detecting this as a phone or PDA, but for rendering it should be treated just as any desktop browser; one that doesn't support flash. There is no WML or xHTML-MP support, and from a mobile content provider standpoint, there is not a lot you can do with the iPhone. Just feed it regular HTML or xHTML pages.

Also note that the iPhone is not using the AT&T mobile gateway so you are not going to get any of the headers that tip you off that it's a mobile device; not even an x-up-subno. Good thing it supports cookies, although as always I recommend session tracking for all mobile devices using URL rewriting.

Right now it's obvious that the iPhone is coming from AT&T, but as other network operators launch it, it may become difficult to detect the network operator due to lack of headers. You can track the remote-host or remote-addr, but if the phone is in WiFi mode, you are going to end up with Host/IP data that doesn't map to a network operator.

About

This page contains a single entry from the blog posted on July 3, 2007 6:30 AM.

The previous post in this blog was Has the Revolution Started Yet?.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.31