0

I know I can get the iOS version and can also know if user is using an iPod Touch, iPad or an iPhone by reading the browser agent via this code:

$_SERVER['HTTP_USER_AGENT'];

But, can I detect the specs of iOS device? Like if a user is using an iPhone, is it an iPhone 4S, iPhone 4, iPhone 3GS or iPhone 3G?.

Umair Khan Jadoon
  • 2,874
  • 11
  • 42
  • 63
  • Possible duplicate: http://stackoverflow.com/questions/6322112/check-if-php-page-is-accessed-from-an-ios-device – Jason McCreary Jun 29 '12 at 18:09
  • @Jason I mean to ask if one can detect the specs of the detected iOS device. The question you are referring to is about just detecting an iOS device, not exploring the specs. – Umair Khan Jadoon Jun 29 '12 at 18:12

2 Answers2

0

Here's a sample for the User-Agent send by an iOS device in Safari.

Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3

Looks like the OS version is included (OS 5_1_1). But nothing specific about the model/generation of the iOS device. You could loosely infer this from the version (e.g. 3G can't run OS > 5). But that's speculation at best.

I am curious about Mobile/9B206… This likely pertains to Safari, not the device.

Jason McCreary
  • 71,546
  • 23
  • 135
  • 174
0

Kind of, notice the difference in the User Agent from iPhones using iOS 4 and iOS 5:

iPhone -- iOS 4: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5

iPhone -- iOS 5: Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

Then you could find a substring within that string

LOLapalooza
  • 2,042
  • 3
  • 17
  • 22