iPhone user agent

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 Responses to iPhone user agent (Leave a comment)

  1. 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 |
    +——————————————————————————————————————————+

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

  3. 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.

  4. 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/

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

  6. 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.

  7. 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.

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

    It’s a little easier.

  9. 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!

  10. 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.

  11. 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.

  12. 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 🙂

  13. 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?

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

  15. 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.

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

  17. 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.

  18. Brennan Falkner

    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

  19. Thanks Matt for the info!

  20. 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…)

  21. 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.

  22. 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/

  23. 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/

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

  25. 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!

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

  27. 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

  28. 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)

  29. 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

  30. 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/

  31. 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 🙂

  32. 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.

  33. 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.

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

  35. 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 😉

  36. Dears,

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

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

  38. 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.

  39. And me for a Samsung… 😀

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

  41. 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

  42. 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

  43. 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.

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

  45. 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.

  46. 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.

  47. 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';}?>" />

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

  49. 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?

  50. 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.

  51. How can i change the user agent of iphone opera?

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

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

  54. 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

css.php