41

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

Andy
  • 4,783
  • 2
  • 26
  • 51
dallen
  • 2,621
  • 7
  • 37
  • 47
  • On this [SO answer](http://stackoverflow.com/a/12580745/363573), you can find a generic regular expression to check if a given user agent string is a **iOS 4** one. – Stephan Sep 25 '12 at 11:32
  • @Stephan: no, you can't. There is no difference between iPhone 3 or 4 or whatever. – Andy Jun 02 '15 at 09:06

7 Answers7

83

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

alex
  • 479,566
  • 201
  • 878
  • 984
Dan Heberden
  • 10,990
  • 3
  • 33
  • 29
  • 1
    not that I don't believe you, but what is your source for this info? – rmeador Jun 23 '10 at 21:59
  • 5
    Here, I found the source, straight from Apple: http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html – YOMorales Jun 30 '11 at 18:13
  • How can I find the user agent of the current device through the code? – Shri Jan 10 '12 at 14:32
  • @Shri - Put your last in a new question, not a comment of an answer to a related question. – user66001 May 06 '14 at 04:33
  • 1
    This is no valid answer anymore! iPhone OS 4_0 is a long time ago, so already with a upgrade of iOS this answer would be invalid. – Andy Jun 02 '15 at 09:01
  • I got `iPhone OS 4_0` today from my iPhone 7 and I have no idea how or why! – Simon_Weaver Nov 16 '17 at 09:36
9

You can use:

http://whatsmyuseragent.com/

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

licorna
  • 5,670
  • 6
  • 28
  • 39
  • 1
    iPhone 4 won't be released until tomorrow. – Charles Jun 23 '10 at 21:14
  • 1
    People have received shipments as early as yesterday – Dan Heberden Jun 23 '10 at 21:16
  • 1
    Maybe my answer is not completely right if you wanted to know iPhone4 User-Agent without owning one (because you were analyzing web server logs or something), but I wanted to show and *document* how to get the user-agent from any device connected to Internet. Hope it helps to someone. – licorna Jun 23 '10 at 21:42
  • 1
    its totally right; and there isn't a difference between a 3gs, 3g and iphone4 all running ios4. It's still "iPhone"... if you google the reported user-agents of iphone4's or go to whatsmyuseragent.com with a 3g(s) updated to ios4 it's the same user agent. – Dan Heberden Jun 23 '10 at 23:39
  • 1
    @Charles, My iPhone 4 arrived at 10:00 this morning. – Mike Meyer Jun 24 '10 at 01:09
9
  • 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

...for now

Phil
  • 1,200
  • 13
  • 17
3

This site seems to keep a complete list that's still maintained

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.

Nate
  • 31,017
  • 13
  • 83
  • 207
3

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

user66001
  • 774
  • 1
  • 13
  • 36
John
  • 5,672
  • 7
  • 34
  • 52
2

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.

Using the Safari User Agent String

Not even WURLF can.

Andy
  • 4,783
  • 2
  • 26
  • 51
0

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!)

Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689