An Easy Way to Retrieve Your Phone’s User Agent

Form to email phone's User-AgentWhenever I hear about a new phone release I try to test my mobile sites with it, particularly if it carries a new browser like the T-Mobile G1, Blackberry Storm or the Polaris browser found on the Helio Drift and Kickflip.  I have no budget for test handsets so I test with the demo phones in carrier owned mobile shops.  When I find an issue in testing I capture the phone’s User-Agent string so I can modify my browser detection and adaptation code to handle it properly.  There are mobile pages that can display the headers on the phone’s screen. I used to use one of these sites and write the User-Agent down in a notebook, but that’s a bit laborious and very error prone. So I came up with a little script that displays the User-Agent and several other “interesting” headers on the screen and offers the option to email them.

I found my script to be a real time saver and think others might find it useful. Point your mobile or desktop browser at or to try it out.

Knowing your phone’s user agent isn’t only useful to developers.  There are a number of mobile phones and mobile operators that block OTA downloads of games, applications, ring tones, themes and wallpapers.  This is true of Nextel, Boost, Verizon and Virgin Mobile in the US.

In many cases it’s possible get about these restrictions using a cable or BlueTooth to side-load the content on your phone. On Verizon phones, the only off-portal way to load ring tones is by sending them in an MMS.  Before you can do any of these things you have to get the files on your PC.  Usually this pretty easy.  But some software and content vendors only allow downloading OTA to your phone and they check the phone’s User-Agent to deliver the correct version, or no version at all it the phone is unsupported or you are using a PC web browser.  There is a work around.  A Firefox extension called User Agent Switcher lets you temporarily change the browser’s User-Agent to anything you want. Once you have your phone’s User-Agent you can impersonate it with User Agent switcher and download the files you need.

Besides the User-Agent, my script also reports the Accept, Accept-Encoding, Accept-Language and Accept-Charset headers as well as the Via header and any “X” headers.  The Via and X headers can be used to identify transcoders. Many browsers send an x-wap-profile header which contains the URL of a UAProf file describing the device’s characteristics.

Here are a couple examples of the script’s output:

This is what my N95’s built in WebKit Browser sends:

user-agent: Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95-3/20.2.011; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413
accept: text/html,text/css,multipart/mixed,application/java-archive, application/java, application/x-java-archive, text/, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.oma.dd+xml, application/vnd.oma.drm.rights+xml, application/vnd.oma.drm.rights+wbxml, application/x-nokia-widget, */*
accept-language: en-us, en;q=1.0,fr-ca, fr;q=0.5,pt-br, pt;q=0.5,es;q=0.5
accept-charset: iso-8859-1, utf-8; q=0.7, *; q=0.7
accept-encoding: gzip, deflate, x-gzip, identity; q=0.9
x_nokia_musicshop_bearer: WLAN
x_nokia_musicshop_version: 1.0.0
x_wap_profile: ""

These are the headers sent by the same phone using Opera Mini:

user-agent: Opera/9.50 (J2ME/MIDP; Opera Mini/4.2.13216/428; U; en)
accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
accept-language: en,en;q=0.9
accept-charset: iso-8859-1, utf-8, utf-16, *;q=0.1
accept-encoding: deflate, gzip, x-gzip, identity, *;q=0
x_operamini_features: advanced, file_system, folding
x_operamini_phone: Nokia # N95
x_operamini_phone_ua: Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95-3/20.2.011; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413

Spammers love to use email scripts like this one to send junk to everyone’s mailbox.  I’ve added a lot of safeguards and input checking to the script try and prevent its misuse.  If I find it’s being used to send spam I’ll have to take it down,  of course.  It’s also possible that my anti-spammer code will cause the script to fail on phones that send some really weird headers.  If you get an error message saying something about a “Suspected injection attempt”, “invalid email address” or “newline found” please let me know via a comment on this post or by using the Contact Form.  Please include the name of your carrier and phone and, if possible, the full text of the error message.

If your are worried about providing your email address,  I don’t store email addresses and will never share  yours with anyone.  If you want to be extra safe, use a disposable email address from a free service like or Yahoo Mail’s Addressguard.

If you are a or user, I’ve added a link to labeled “View User-Agent” in the Technology/Mobile/MobileTech section of both mobile sites for your convenience.

6 thoughts on “An Easy Way to Retrieve Your Phone’s User Agent

  1. Hi Dennis. Sorry that i gave a restricted page. Anyway, here is the zip file with the two apps. One is iphonesque and the other UAchanger, a python based app. Only the former needs to be signed. You dont need a hacked phone for this to work(in fact, mine is unhackable. I have a devcert though). Just install the two apps. Start the second one, choose the UA. The best part is the UA of the s60 browser could be changed within a session. Just a page reload required :D. Enough said, here is the d’load link

  2. @Jbpseudo

    Thanks, I don’t think the UA-changer script is off-topic at all and I don’t mind commenters linking out as long as it’s to something that’s not spammy.

    I did notice that I couldn’t see the post on Symbian-Freak until I registered on the forum and logged-in. A stupid restriction if you ask me.

    It also looks like you need to install the Mobile Signer hack on your phone to get this to work.

Comments are closed.