Iphone version user agent

How can I determine the iOS version with iOS user-agent strings?

I have a list of iOS User-Agent strings for approximately 50 different iPhone’s and 30 different iPad’s. I want to know if user-agent strings like Apple-iPad4C5/1202.410, Apple-iPhone4C1/1202.466 etc. can be used to determine the current iOS version running on these devices.

2 Answers 2

My iPhone 6 running iOS 8.2 has this user agent string:
Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D508 Safari/600.1.4

You can see iPhone OS 8_2 within that string. This is the OS version. You can parse that out.

Apple has documented the format of the Safari User-Agent string in the Safari Web Content Guide. You can look at the examples there to see how the User-Agent embeds the iOS version number. Examples include CPU iOS 2_0 and CPU OS 3_2 .

Note, however, that third-party browsers (any app that uses a UIWebView , really, which includes many popular apps) can and often do customize the User-Agent.

Not the answer you’re looking for? Browse other questions tagged ios or ask your own question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.12.9.40950

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Detecting iOS Version Number from User Agent using Regular Expressions

If I have an iOS user-agent like

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/7D11

How would I detect the iOS version using regular expressions so that it would return e.g.

for the above user agent?

4 Answers 4

The RegEx that is working for me is:

An iPad 5.1.1 has an HTTP_USER_AGENT like this:

So 3 numbers in the iOS version and not iPhone OS present.

A possible Ruby implementation could be:

It returns nil if not iOS version found

This regular expression should do what you want :

you have to capture the two matching group values, how to do it depends on the language you use .

With php you can do it in this way :

This regex will match 2 and 3 segments like 4.0 or 6.1.3

Note that this may also match other devices, so make sure you test this on a iOS device.

This will return the OS X version on a Mac.

You also may want to replace the _ by . using .replace(/_/g,’.’); or even convert it to a array using .split(‘_’); .

I found the existing answers didn’t have a good success rate when tested against the possible user agent strings on this web page of example user agent strings:

I have created the following regex which has more success when tested against these examples:

The fourth group contains the ios version number which is in the format x_y_z or x.y.z where y and z are optional.

There are 7 examples user agent strings which do not contain any version number so those particular ones are not matched. There is one example string where the ios version is «7.1» but the regex matches only the major version number «7» (this was good enough for my use case)

Читайте также:  Загрузка apple по сети

As well as the tests on the above page its also been tested against the ios10 agent strings listed on this page:

Источник

Tips & Tricks: изменяем User Agent в iPhone

Как известно, User Agent необходим для «идентификации» пользователя, а конкретнее, для определения, каким клиентом или через какое устройство заходит пользователь к вам на сайт. В зависимости от этого, можно «подставлять» необходимый контент (данные, разметку). Это актуально в последнее время по причине большого роста мобильных устройств.

В продолжении темы iPhone Dev Tips & Tricks расскажу о том, как поменять User Agent на «iPhone».

Для того, чтобы получить некий контент, который чувствительный к User Agent (в моем конкретном случае я хочу получить XML файл), необходимо выполнить следующий код:

NSURL *url = [[NSURL alloc] initWithString:@»http://domain.com/SomeXml.xml»];
NSHTTPURLResponse *response;
NSError *error;
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setValue:@»Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)» forHTTPHeaderField:@»User-Agent»];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

Как видите, для решения задачи необходимо воспользоваться setValue:forHTTPHeaderField для вашего запроса (NSMutableURLRequest).

В моей конкретной задаче я использовал NSData, так как мне необходимо было использовать полученный XML для NSXMLParser:

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:data];
NSLog(@»XML is downloaded.»);

Источник

What is the iPhone 4 user-agent?

Has anyone found the iPhone 4’s browser’s user-agent string yet?

7 Answers 7

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7

To find your user agent (Google: «What is my user agent» gives this answer)

  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/7D11
  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7
  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7
  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2 like Mac OS X; en_us) AppleWebKit/525.18.1 (KHTML, like Gecko)
  • Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5

iPhone, iPod Touch, and iPad from iOS 2.0 — 5.1.1 (to date).

You do need to assemble the full user-agent string out of the information listed in the page’s columns.

iOS 4.3.2’s User Agent, which came out this week, is:

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

You cannot identify the (hardware) version of an iPhone by user agent.

It’s only possible to recognize that it’s an iPhone and which software versions it’s running.

Note: The user agent strings from Facebook’s internal browser do indicate the actual physical device. Even the cellphone carrier (eg. AT&T)

Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 [FBAN/FBIOS;FBAV/149.0.0.39.64;FBBV/79173879;FBDV/iPhone7,2;FBMD/iPhone;FBSN/iOS;FBSV/10.3.3;FBSS/2;FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0

Mozilla/5.0 (iPhone; CPU iPhone OS 11_1 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B93 [FBAN/FBIOS;FBAV/148.0.0.45.64;FBBV/78032376;FBDV/iPhone10,4;FBMD/iPhone;FBSN/iOS;FBSV/11.1;FBSS/2;FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]

These won’t be the case in Safari or Chrome from iOS — only within the browser inside the Facebook app.

(I’m getting iPhone9 too though — not quite sure what that is!)

Источник

List of User Agent strings

Published: 23 October 2018

The User-Agent (UA) string is contained in the HTTP headers and is intended to identify devices requesting online content. The User-Agent tells the server what the visiting device is (among many other things) and this information can be used to determine what content to return. Of course this requires using a device detection solution which translates UAs into understandable software and hardware information.

User-Agent list for different device types

There are millions of User-Agent combinations given that UAs change with the software and hardware. For example, a Chrome browser on an iPhone 6 will introduce itself using a different UA than a Safari browser on the same phone.

Every device type, including phones, tablets, desktops, may come with its own UA that makes it possible to detect this device for any purpose. Interestingly bots and crawlers also come with their unique UAs.

Читайте также:  Apple macbook pro touch bar 16 late 2019

Here is a list of example User-Agents for different device types that can be detected. If you’d like to learn more on these devices, just copy and paste the UAs to our User-Agent testing tool. You’ll see all the properties of a detected device.

Get access to a free, trial version of DeviceAtlas.

Android Mobile User Agents

Samsung Galaxy S9
Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36
Samsung Galaxy S8
Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36
Samsung Galaxy S7
Mozilla/5.0 (Linux; Android 7.0; SM-G930VC Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/58.0.3029.83 Mobile Safari/537.36
Samsung Galaxy S7 Edge
Mozilla/5.0 (Linux; Android 6.0.1; SM-G935S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36
Samsung Galaxy S6
Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36
Samsung Galaxy S6 Edge Plus
Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36
Nexus 6P
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36
Sony Xperia XZ
Mozilla/5.0 (Linux; Android 7.1.1; G8231 Build/41.2.A.0.219; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36
Sony Xperia Z5
Mozilla/5.0 (Linux; Android 6.0.1; E6653 Build/32.2.A.0.253) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36
HTC One X10
Mozilla/5.0 (Linux; Android 6.0; HTC One X10 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.98 Mobile Safari/537.36
HTC One M9
Mozilla/5.0 (Linux; Android 6.0; HTC One M9 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.3

If you’re wondering which devices are most common where you are, read our list of the world’s most popular Android devices.

iPhone User Agents

Below are examples of User Agent strings used by the most popular iPhone devices. As Apple do not pass much info through the User Agent, version numbers don’t allow us differentiate between iPhone models.

However, with DeviceAtlas client-side, you can classify these user agents to return correct device model.

The Complete Guide To User Agents.

Download our free e-book on User Agents to learn:

  • What is a User Agent?
  • How do you parse them?
  • What can you do with them?

For more on how to detect exact iPhone 8/8 Plus and iPhone X models, read our guides on How To Detect iPhone 8/X and how to detect the latest iPhones — the XR, XS and XS Max.

Apple iPhone XR (Safari)
Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1
Apple iPhone XS (Chrome)
Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/69.0.3497.105 Mobile/15E148 Safari/605.1
Apple iPhone XS Max (Firefox)
Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/13.2b11866 Mobile/16A366 Safari/605.1.15
Apple iPhone X
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
Apple iPhone 8
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1
Apple iPhone 8 Plus
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1
Apple iPhone 7
Mozilla/5.0 (iPhone9,3; U; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1
Apple iPhone 7 Plus
Mozilla/5.0 (iPhone9,4; U; CPU iPhone OS 10_0_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A403 Safari/602.1
Apple iPhone 6
Mozilla/5.0 (Apple-iPhone7C2/1202.466; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3

MS Windows Phone User Agents

Microsoft Lumia 650
Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; RM-1152) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Mobile Safari/537.36 Edge/15.15254
Microsoft Lumia 550
Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; RM-1127_16056) AppleWebKit/537.36(KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10536
Microsoft Lumia 950
Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.1058

Tablet User Agents

Google Pixel C
Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36
Sony Xperia Z4 Tablet
Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36
Nvidia Shield Tablet K1
Mozilla/5.0 (Linux; Android 6.0.1; SHIELD Tablet K1 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Safari/537.36
Samsung Galaxy Tab S3
Mozilla/5.0 (Linux; Android 7.0; SM-T827R4 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Safari/537.36
Samsung Galaxy Tab A
Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T550 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.3 Chrome/38.0.2125.102 Safari/537.36
Amazon Kindle Fire HDX 7
Mozilla/5.0 (Linux; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/47.1.79 like Chrome/47.0.2526.80 Safari/537.36
LG G Pad 7.0
Mozilla/5.0 (Linux; Android 5.0.2; LG-V410/V41020c Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/34.0.1847.118 Safari/537.36

If you’re looking for a list of mobile browser user-agents, we’ve got them too — List Of Mobile Browser User-Agent Strings .

Desktop User Agents

Windows 10-based PC using Edge browser
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246
Chrome OS-based laptop using Chrome browser (Chromebook)
Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36
Mac OS X-based computer using a Safari browser
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9
Windows 7-based PC using a Chrome browser
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
Linux-based PC using a Firefox browser
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

Bring device intelligence to your web applications in minutes.

For the web, native apps and mobile operator environments.

Set Top Boxes User Agents

Chromecast
Mozilla/5.0 (CrKey armv7l 1.5.16041) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.0 Safari/537.36
Roku Ultra
Roku4640X/DVP-7.70 (297.70E04154A)
Minix NEO X5
Mozilla/5.0 (Linux; U; Android 4.2.2; he-il; NEO-X5-116A Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
Amazon 4K Fire TV
Mozilla/5.0 (Linux; Android 5.1; AFTS Build/LMY47O) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/41.99900.2250.0242 Safari/537.36
Google Nexus Player
Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus Player Build/MMB29T)
Apple TV 5th Gen 4K
AppleTV6,2/11.1
Apple TV 4th Gen
AppleTV5,3/9.1.1

Game Consoles User Agents

Nintendo Wii U
Mozilla/5.0 (Nintendo WiiU) AppleWebKit/536.30 (KHTML, like Gecko) NX/3.0.4.2.12 NintendoBrowser/4.3.1.11264.US
Xbox One S
Mozilla/5.0 (Windows NT 10.0; Win64; x64; XBOX_ONE_ED) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Xbox One
Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586
Playstation 4
Mozilla/5.0 (PlayStation 4 3.11) AppleWebKit/537.73 (KHTML, like Gecko)
Playstation Vita
Mozilla/5.0 (PlayStation Vita 3.61) AppleWebKit/537.73 (KHTML, like Gecko) Silk/3.2
Nintendo 3DS
Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU

Bots and Crawlers User Agents

Google bot
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Bing bot
Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
Yahoo! bot
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)

E Readers User Agents

Amazon Kindle 4
Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+
Amazon Kindle 3
Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600×800; rotate)

Learn more about User-Agents

If you’re looking for more information on User-Agents, be sure to read these posts on the DeviceAtlas blog:

Get Instant access to a DeviceAtlas Cloud trial

DeviceAtlas Cloud offer a great way to start detecting mobile device traffic to your site:

  • Optimize website content for mobile, tablet, and other devices
  • Boost website loading time and minimize page weight
  • Handle traffic from any device as you want

Get started with a DeviceAtlas Cloud trial today.

Источник

Читайте также:  Если у айфона люфт что это
Оцените статью