iPhone user agent

by on July 9, 2007

in Gadgets/Hack,How to,iPhone

The iPhone launched with this user agent:

Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

Here’s a tip to find out the user agent for any browser or device that you’re on (e.g. a kiosk at a mall, a different cell phone, or something else that you tinker with):

- Go to Google
- Search for the word phpinfo. If you visit a webserver running the phpinfo() command, the resulting web page will tell you info about the web server, but it will also tell you about your browser’s user agent.
- Look for a page that actually runs phpinfo() instead of documentation about phpinfo(). Usually there’s a few such pages in the top 10. If you’re having trouble finding a phpinfo() page, you can do a more specific search for the words phpinfo http_user_agent.
- Click on the phpinfo() page and near the bottom of the page look for a string called HTTP_USER_AGENT. You’ll see something like this:

phpinfo user agent

Sorry that the picture runs in the right-hand column; I didn’t want to clip or resize the image. I took this picture running Firefox on my Ubuntu Desktop, so that’s the user agent you see. But this tip works with iPhones and almost any other browser that can search on Google.

{ 54 comments… read them below or add one }

Justin July 9, 2007 at 9:35 am

It actually has several agents, this is a sampling from several hundred or more phones..

+——————————————————————————————————————————+
| k |
+——————————————————————————————————————————+
| Mozilla/5.0 (iPhone; U; XXXXX like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/241 Safari/419.3 |
| Mozilla/5.0 (iPhone; U; XXXXX like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A477c Safari/419.3 |
| Mozilla/5.0 (iPhone; U; XXXXX like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A477d Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A498b Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A535b Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A538b Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Kevin) Version/3.0 Mobile/1A543a Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A566a Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C9 Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C10 Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A522a Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C6 Safari/419.3 |
| Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A537a Safari/419.3 |
+——————————————————————————————————————————+

Reply

The How-To Geek July 9, 2007 at 9:46 am

What I usually do in this case is just resize my browser so the table shrinks to the right size before taking the screenshot =)

Reply

Ryan July 9, 2007 at 10:32 am

neat tip. Didn’t think of it. I had forgotten that phpinfo included that, and actually wrote a small 1 liner to spit out just that information for me when I was writing some mobile apps last nite.

It might be helpful to include tips for your readers about how to check the headers in code and redirect appropriately. I know I’ve been asked several questions about it myself since blogging about writing for the iPhone.

I said it before, but I really think the iPhone browser is going to steer developers toward thinking about the mobile web and mobile devices. We should see a lot of cool things come out in that area in the next few months.

Reply

Michael Jensen July 9, 2007 at 10:32 am

Got my iPhone too, way too much fun!

I built an app a few days before the iPhone was released and have been watching stats with Google Analytics. I recently posted about how to tell if you have iPhone visitors because Google doesn’t discriminate in browser or OS between the iPhone and Mac visitors, except in screen resolution:

http://www.soloseo.com/blog/2007/06/30/how-to-tell-iphone-visitors-in-google-analytics/

Reply

Netmeg July 9, 2007 at 10:41 am

Yep, we noticed our first iPhone user agent string on my fireworks website on July 3rd.

Reply

Justin July 9, 2007 at 10:50 am

By the way I threw together a badly written but workable iPhone speed test that uses AJAX to first test latency in serial requests, then measure the thruput when asked to download a 250kb file in parallel.
http://i.dslr.net/tinyspeedtest.html
The results are not great over EDGE. Latency is very high, and variable. speed is at best mid 100kbit range, often worse.

Reply

Ben Reubenstein July 9, 2007 at 10:53 am

Good info. I am detecting user agent on my iPhone app, http://www.iphonenetworktest.com/ to save results from the tests. Hoping to do a big report soon, and also see if anyone is fudging there user agent.

Reply

SuperJason July 9, 2007 at 10:56 am

You could just use http://whatsmyuseragent.com/

It’s a little easier.

Reply

Kenrick July 9, 2007 at 12:01 pm

omg people please turn off phpinfo for the sake of your host. up until recently there was a nice XSS security hole in phpinfo too. eek!

Reply

Eric Giguere July 9, 2007 at 12:24 pm

See also my article Masquerading Your Browser for a detailed explanation about the User-Agent header and my HTTP Header Viewer tool as another way to see what the heck your browser is sending.

Reply

Matt Cutts July 9, 2007 at 12:51 pm

The How-To Geek, that should have occurred to me, but thanks for mentioning that.

Michael Jensen, that’s a really neat interim idea!

SuperJason, I was wondering if there was a site like that. Thanks for surfacing it. :) Given how many sites try to answer the “what is my ip address” query, I’m surprised that there aren’t more sites that provide the user agent for you.

Eric Giguere, very nice! I like LiveHTTPHeaders when I’m on Firefox as well.

Reply

Eric Giguere July 9, 2007 at 1:03 pm

Yes, if you can run Firefox on whatever device you’re using then LiveHTTPHeaders works quite well. It’s also a nice way to decloak encrypted links… I think a lot of people know me because of my AdSense blog these days, but I do geeky stuff too :-)

Reply

Matt Sandy July 9, 2007 at 1:15 pm

I usually go to ipchicken.com to find that stuff out, including my ip. It is simple, and sure it has some ads, but it is easy to remember.

So Matt, if a site checks to see if you are on the iphone and gives you a stripped down page, will you call that cloaking?

Reply

Andrew Hitchcock July 9, 2007 at 1:19 pm

Thanks for the info Michael, I was about to ask how to do that.

Reply

Matt Cutts July 9, 2007 at 2:40 pm

Matt Sandy, the beauty of the Apple guide page is that they tell you how to design a page that looks good in both iPhone and browser at the same time. I’ll talk about it soon.

Reply

kczm July 9, 2007 at 4:07 pm

It seems Iphone like a little PC,CPU,OS,and Browser.

Reply

Matt Sandy July 9, 2007 at 4:32 pm

Looking good in two browsers is different than looking great in both which is something I like to aim for :-) . At one point I wrote a javascript that would load a different stylesheet based on what you resized your browser window to and change the size of the header, the page, and removed the right column, yet everything worked for lynx as it should. I was told afterwards that I needed to remove that because they would rather have horizontal scroll and keep the content on the right column. To each his own I guess.

Reply

Brennan Falkner July 9, 2007 at 4:57 pm

Matt Sandy: IPhone sort of accepts its own media type, “only screen and (max-device-width: 480px)”, so you can feed it a different stylesheet without messing with javascript or serving different html based on user-agent. http://developer.apple.com/iphone/designingcontent.html

Reply

Jeff July 9, 2007 at 5:54 pm

Thanks Matt for the info!

Reply

Eric Giguere July 9, 2007 at 5:58 pm

Developers interested in creating web pages that work well in mobile devices should look at the AvantGo developer documentation for some guidelines. Some of the advice there is specific to the AvantGo browser, but many of the concepts (like avoid using tables, test on multiple devices and resolutions, etc.) are universal. (Disclaimer: I’m the developer for the BlackBerry version of the AvantGo browser. Certainly some of the issues people are encountering with web browsing on the iPhone is stuff we’ve dealt with for many years…)

Reply

Multi-Worded Adam July 9, 2007 at 8:53 pm

Since Igor provided the PHP code, I figured someone should provide the ASP code.

For those on a Windows Server, create a file called user-agent.asp and put the following lines of code in:

<%
Response.Write Request.ServerVariables (“HTTP_USER_AGENT”)
%>

Upload that to a server you have FTP access to, remember the URL, and type it in whenever you want. No need to worry about your IP address being recorded, either.

Reply

jackie113 July 9, 2007 at 11:55 pm

Say you’ve downloaded Cars from iTunes. Instead of watching it on your computer, wirelessly sync the flick to Apple TV.Then pull up a seat, put up your feet, and play your movie on TV. Give yourself a hand: You’ve just changed theway you watch digital media.

http://www.mp4-converter.net/apple-tv-converter/

Reply

Multi-Worded Adam July 10, 2007 at 5:49 pm

Say you’ve copied text directly from the Apple website, jackie113. Give yourself a foot in the ass. You’ve just spammed a blog.

http://www.apple.com/appletv/

Reply

zhaiduo July 10, 2007 at 8:14 pm

it’s great! we can do some special for iPhone visitors.

Reply

Jamie July 11, 2007 at 7:35 am

Thanks for this info Matt, not a method I’ve ever used to look at my HTTP headers but it does work very nicely.

Of slightly more interest was the opportunity to look at the Google cache of the page, which allowed me to look at the HTTP headers from the Googlebot session!

Reply

Mike Day July 12, 2007 at 4:29 am

No iPhone for us in the UK for a while – so i’ve just signed up for a new Nokia in the mean-time.

Reply

vladimir July 13, 2007 at 11:03 am

Matt,

What do you think about .mobi extension. Is it going to be popular after apple came up with iphone, i mean now you can open regular website in iphone safari browser, its only looks small. Before that we were building special interface for other pda devices, using wap application.
The question is, would it be reasonable to invest money and reserve .mobi extension.
Your opinion is important

Reply

Liam Clancy (metafeather) July 13, 2007 at 11:52 am

For more detailed information (especialy when troubleshooting a client’s browser) I like to get a detailed BrowserHawk report as a first step so I know exacty what I’m dealing with (JS version, plugins, etc):

http://www.cyscape.com/showbrow.aspx

Anyone willing to post the result for the iPhone somewhere?

(I’m just a satisfied BrowserHawk customer)

Reply

alek July 15, 2007 at 8:01 am

Just to stick up for the Perl Hackers of the world, this is (of course) doable in other languages, Here’s one I wrote years ago that shows the User Agent and other misc. info … plus geolocation – http://www.komar.org/cgi-bin/ip_to_country2.pl

Reply

Shankar July 18, 2007 at 9:41 pm

How about the useragent from Opera Mini 4… did any one check it. Opera mini 4 can now display adsense and your click gets counted. As everytime I browse the foot prints are not from my device but from their proxy server, the click is actually considered from USA. And how does google manage the ad clicks this time. :) read this post
http://www.mobilejgames.com/2007/07/18/googles-difficulty-in-over-coming-opera-mini-diffcuilty/

Reply

Travis July 24, 2007 at 12:56 pm

Using phpinfo or your own webpage to parse out the user agent is fool proof and handy if you have the actual device, but if you need the user agent info for a device you don’t have you’ll need access to a mobile device database to look up the necessary info.

The WURFL is an open source database of all the mobile devices and it contains info on the specs (and specifically) the user agents of each device.

I have built up a ‘browseable WURFL’ on my site. The iPhone specific page is here: http://www.distinctquality.com/mobile/model/iPhone/, though you can use the links on the page to view user agent and various specs for any mobile device by brand/model. There are about 3500 devices on the site now. I refresh the device database every month or so to add new models.

Its not perfect, but it beats having to write an interface to the WURFL yourself :)

Reply

jorrsbm August 3, 2007 at 2:00 am

quote
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
All Converter is a powerful, all-in-one, multimedia application converting the media files among the most popular media formats.

Reply

jacobryan003 August 16, 2007 at 10:17 pm

also sad because apple stores have no shortness of iphones. lets cry for those idiots who spent 1,500 on ebay for one of these.

Reply

Roni Doani August 30, 2007 at 6:16 am

Matt Sandy,
If you dont like ads, there is http://www.iplobster.com/

Reply

mark August 31, 2007 at 3:01 pm

I suppose you could upload an image to places like image shack which will automatically resize and link to the actual file … perhaps next time ;)

Reply

John October 23, 2007 at 9:01 pm

Dears,

How can i change the user agent of iphone safari? thx!!! John

Reply

drhady November 4, 2007 at 11:58 am

i’ve just signed up for a new Nokia in the mean-time

Reply

Henri December 25, 2007 at 5:49 am

I never use user agent variables, because it’s very unreliable. It’s very simple to use a plugin to change the user agent. It’s better to use independent technics and scripts.

Reply

SortiR January 8, 2008 at 4:04 pm

And me for a Samsung… :D

Reply

John January 13, 2008 at 1:44 am

Wouldn’t be easier to just go to a site like http://www.ipsite.org ?

Reply

Jimmy January 18, 2008 at 4:47 am

Can someone post the browser capabilities of iPhone Web browser?

One quick way is to use free demo below.

http://www.browserobject.com/demo.aspx

Reply

Connor March 2, 2008 at 9:41 am

Mm, I think that Version/3.0 Mobile/xxx is the system’s serial number. It’ll be different for every device.

Also, in case anybody is interested, I have the user agent for the iPod Touch as well. This is in Safari on an iPod Touch 1.1.4 without the January Software Upgrade.

Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/xxxxx Safari/419.3

Reply

Marcus Kabele April 1, 2008 at 11:21 am

Version/3.0 Mobile/xxx is documented to be the OS version:

http://developer.apple.com/internet/safari/faq.html

Safari 3 on iPhone contains the additional Mobile/WW portion in the user-agent string – where “WW” is the operating system version number.

Reply

Lars April 2, 2008 at 9:25 am

Connor – the part after Mobile/ is the firmware revision. No Serial.

Reply

jen April 2, 2008 at 4:42 pm

Man, that’s clever. I’ve used phpinfo() before to try to figure out what the heck is wrong with a PHP server I’ve been debugging, but I never considered using it for something like this. Powerful.

Reply

BlackBerryBold9000 September 7, 2009 at 3:14 pm

Using delicious on I phone is really a nice experience for me and its good for me to keep touch with my delicious bookmarks at any time. Thanks for the useful post.

Reply

Alex January 16, 2010 at 2:37 pm

To do a detection in PHP:


<link rel="stylesheet" type="text/css" href="<?php if (stristr($_SERVER['HTTP_USER_AGENT'], 'iphone')){echo 'iphone.css';} else{ echo 'default.css';}?>" />

Reply

Mark Tidmarch April 7, 2010 at 10:25 am

This is a good placer to check your browser info:
spinnette.com/tools/browserInfo.php

Reply

Aaron April 16, 2010 at 10:47 am

Now that Opera is out for the iPhone it clearly has a different UserAgent one I cannot seem to find. I need to add this to some server side code I have so it will redirect properly on my iPhone.

Ideas on Opera iPhone redirection?

Reply

Tim Acheson November 3, 2010 at 8:29 am

You can check the version of Safari or any web browser on an iPhone/iPad, quickly and easily, by entering one short script into the address bar.

Follow my simple instructions here:
http://twitter.com/timacheson/status/29580118976

There’s no need to visit any special website.

Reply

pars March 15, 2011 at 4:17 pm

How can i change the user agent of iphone opera?

Reply

Anon May 5, 2011 at 3:23 pm

Search for “what’s my user agent”. It’s far quicker than trying to find a phpinfo server.

Reply

selin June 13, 2011 at 9:10 am

Nice review! Thanks for offering innovative topic here. I enjoyed reading article a lot. Thank you very much.

Reply

Jerry August 28, 2011 at 5:58 pm

If you need to know the user agent on any devise or browser, just go to jerrywickey.com/botproject/agentout.php

Feel free to use.

Jerry

Reply

Leave a Comment

If you have a question about your site specifically or a general question about search, your best bet is to post in our Webmaster Help Forum linked from http://google.com/webmasters

If you comment, please use your personal name, not your business name. Business names can sound salesy or spammy, and I would like to try people leaving their actual name instead.

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: