120

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad.

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

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Yoric
  • 3,348
  • 3
  • 19
  • 26
  • 2
    How would you want to adapt to the iPad when you cannot be sure that your changes fit? – Gumbo Jan 28 '10 at 10:50
  • 9
    I think the idea is to make sure that when someone loads your site on the iPad, it's not going to think it's an iPhone. The user agent is important for any application or website that detects and acts on it. – Philip Morton Jan 28 '10 at 10:53
  • All the answers are several years out of date - I just look up options here: http://www.webapps-online.com/online-tools/user-agent-strings (a little effort to drill down, but it has every device you might ever need). – brichins Dec 02 '16 at 23:24

15 Answers15

128

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

alex
  • 479,566
  • 201
  • 878
  • 984
njy
  • 1,336
  • 1
  • 8
  • 2
  • 18
    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 Jul 08 '10 at 19:17
  • 2
    Hey folks, here's the user agent details in the Safari Developer Library: http://developer.apple.com/library/safari/#technotes/tn2010/tn2262/_index.html – Matthew Setter Jan 31 '12 at 10:30
  • 6
    Here's another, more comprehensive and informative link: http://developer.apple.com/library/IOs/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html – Matthew Setter Jan 31 '12 at 11:03
  • This answer is incorrect. From iOS 13 there is now no mention of iPad at all. – CpnCrunch Dec 16 '19 at 18:51
  • See the updated answer below: https://stackoverflow.com/questions/2153877/what-is-the-ipad-user-agent/56923008#56923008 – zvi Dec 22 '19 at 09:41
  • You can use a combination of userAgent regex detection for Mac OS /mac os/i and navigator.maxTouchPoints. On a Macbook, etc, navigator.maxTouchPoints will always be 0, while on iPad or iPhone, maxTouchPoints will be > 0 (currently 5 for iPad). – ChrisN Oct 28 '21 at 20:03
37

(almost 10 years later...)

From iOS 13 the iPad's user agent has changed to Mac OS, for example:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15

zvi
  • 3,677
  • 2
  • 30
  • 48
  • that's what we get as well on an iPad Pro. So there is no way to differentiate between iPad / iOS and Mac OS anymore? – low_rents Jan 21 '20 at 10:11
  • 1
    @low_rents that's really a problem, see here: https://stackoverflow.com/questions/56934826/distinguish-between-ipad-and-mac-on-ipad-with-ipados – zvi Jan 21 '20 at 10:15
28

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

)

Community
  • 1
  • 1
kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • 1
    "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 Jan 28 '10 at 12:22
  • Looks like the difference is suttle... note the spelling of "Machintosh" not "Macintosh" - or is this a typo? – Saul Dolgin Jan 28 '10 at 12:23
  • 1
    Sorry it's typo. Because I can't directly copy from the simulator to the Mac. – kennytm Jan 28 '10 at 12:24
  • 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? – mohdajami Jan 31 '10 at 06:17
  • @medopal: Both are from simulator. There isn't 3.2 for the device yet. – kennytm Jan 31 '10 at 06:48
  • 1
    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) – mohdajami Jan 31 '10 at 12:58
  • ipad really does that.. our site just broke on iPad due to this user agent – Himanshu Arora Dec 13 '19 at 00:32
15

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.
  • 934
  • 6
  • 8
9

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
  • 298
  • 2
  • 6
7

iPad 2 under 4.3.5:

Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5

bluish
  • 26,356
  • 27
  • 122
  • 180
6

Mine says:

Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5

bluish
  • 26,356
  • 27
  • 122
  • 180
BlueEel
  • 359
  • 4
  • 13
4

Here you go!

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

bluish
  • 26,356
  • 27
  • 122
  • 180
Eswar Rajesh Pinapala
  • 4,841
  • 4
  • 32
  • 40
3

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. That is something apple does not recommend doing.

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
3

From iOS 13, can not find 'iPad', i use this js current-device, it work.

this core:

const iPadOS13Up = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1

https://github.com/matthewhudson/current-device/blob/master/src/index.js#L55

you can see you die type : http://matthewhudson.github.io/current-device/

yyman001
  • 46
  • 3
1

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

1

Safari on iPad user agent string in iPhone OS 3.2 SDK beta 3:

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

More info: http://developer.apple.com/library/safari/#technotes/tn2010/tn2262/_index.html

0

I think it is worth mentioning that you don't generally need to use the whole agent string, unless perhaps you find a reason where you need to tailor the website to a specific model.

You can check for iPhone, iPad and iPod in the agent string and cover all your bases.

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
    appleMobileDevice = true;
}
else {
    appleMobileDevice = false;
}
Amicable
  • 3,115
  • 3
  • 49
  • 77
0

Since Apple VERY HELPFULLY changed their userAgent strings in iOS, you can't use a regex for ipad/iphone reliably anymore.

I suggest a combo of a regex for older and current iOS versions (/i(?:pad|phone)|mac os/i) with and additional check for navigator.maxTouchPoints. maxTouchPoints will always be 0 on a Macbook, but greater than 0 on an iPad, iPhone (usually 5).

If you further need to differentiate between iPad and iPhone, you can work with window.outerWidth and window.outerHeight to get the viewport size and orientation. This will only help so much as some of the larger iPhones have viewports that are larger than the smallest iPads.

THANKS, Apple!

ChrisN
  • 302
  • 2
  • 9
-1

For iPad Only

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
Hardik Thakkar
  • 15,269
  • 2
  • 94
  • 81