iPhone User Agent: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)
AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538a Safari/
419.
Second, some code I found on Apple.com for testing for the iPhone [2]:
isiPhone: function(userAgent) {
var agent = userAgent || this.getAgent();
return agent.match(/iPhone/i);
},
Good to know.
Chris
[1] http://twitter.com/Damdam/statuses/111868822
[2] http://images.apple.com/global/scripts/browserdetect.js
I'm recommending against useragent detection unless you are planning
iPhone-only site. For instance, there are some Nokia cell phones using
Safari also, and someday some of them will work with our web pages.
Instead, use CSS3 mediaqueries. Apple recommends for detecting iPhone:
iPhone:
<link media="only screen and (max-device-width:480px)" href
="small-devices.css" type="text/css" rel="stylesheet" />
(Note the use of the keyword 'only' so that old media query browsers
will work right)
Everthing else:
<link media="screen and (min-device-width:481 px)" href="not-small
device.css" type="text/css" rel="stylesheet" />
Of course, if you are going to use canvas you should do user agent
detection of safari, or if you are going to work-around iPhone
specific issues (i.e. things that work in Safari 3.0 but don't work on
the iPhone), the iPhone useragent detection is useful
-- Christopher Allen
http://www.pointatme.com (iphone)
http://www.pointatme.com/about/ (others)
-Hardy
On Jul 1, 4:00 pm, "Christopher Allen" <Christoph...@iPhoneWebDev.com>
wrote: