views:

22971

answers:

6

Now that the iPad craze is officially open, it's time to think websites also for the iPad. From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone/iPod touch. So suddenly, the assumption that iPhone OS = iPhone screen resolution becomes false. Sounds like many sites may have to revise their user-agent -> css mapping.

So, can anyone with access to the iPad or the iPad SDK give us the user-agent string?

Thanks in advance.

+12  A: 

From the simulator, in iPad mode:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9 (this is for 3.2 beta 1)

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (this is for 3.2 beta 3)

and in iPhone mode:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g

I don't know how reliable the simulator is, but it seems you can't detect whether the device is iPad just from the user-agent string.

(Note: I'm on Snow Leopard which the User Agent string for Safari is

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10

)

KennyTM
"Machintosh"? Is that a typo or is it for real?If its for real, that might be how we're supposed to detect it.
Yoric
Looks like the difference is suttle... note the spelling of "Machintosh" not "Macintosh" - or is this a typo?
Saul Dolgin
Sorry it's typo. Because I can't directly copy from the simulator to the Mac.
KennyTM
10.5.8?? Thats the last Leopard version, but the iPad has a tweaked iPhone OS!! is your iPhone signature from the iPhone simulator or from the device?
medopal
@medopal: Both are from simulator. There isn't 3.2 for the device yet.
KennyTM
thats really weird!, why would the iPad report the request is coming from a desktop Safari while the iPhone reports from Mobile Safari? I think the signautre will change soon. The iPad signature is reporting from Intel CPU (wrong), Leopard OS (wrong) and Safari (wrong)
medopal
+26  A: 

Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10

njy
Thanks, that looks good.
Yoric
http://developer.apple.com/safari/library/technotes/tn2010/tn2262.html
jleedev
The accepted answer above isn't it anymore. You can't check the user agent for 'iPhone', has to be 'iPad'. I think jleedev's link above is closer to the real deal:Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
Jon Raasch
A: 

From Simulator 3.2 final:

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10

Christoph S.
+5  A: 

From a real device:

Mozilla/5.0 (iPad; U; CPU OS OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10

Mo
+2  A: 

It's worth noting that when running in web-app mode (using the apple-mobile-web-app-capable meta tag) the user agent changes from:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B405 Safari/531.21.10

to:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405

danjwilson
A: 

it seems to be general consensus that every mobile apple device, iphone, ipad, or ipod uses a user agent that contains both 'Mobile' and 'Safari'.

however, using the latest SDK (4.0.1) and reading the user agent on my rails server (using request.env["HTTP_USER_AGENT"]), we never get the 'Safari' part. no matter whether the request is being made from the simulator or a real device, debug or release. it always looks something like this:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; de-de) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11"

just no 'Safari' :-( so we have to use the 'iPhone' part to be sure. and that is something apple does not recommend doing.

has anybody else this problem? any suggestions?

Philipp Bolliger