{"id":2092,"date":"2008-12-07T22:52:48","date_gmt":"2008-12-08T05:52:48","guid":{"rendered":"http:\/\/wapreview.com\/?p=2092"},"modified":"2020-09-29T21:55:36","modified_gmt":"2020-09-30T04:55:36","slug":"an-easy-way-to-retrieve-your-phones-user-agent","status":"publish","type":"post","link":"https:\/\/wapreview.com\/2092\/","title":{"rendered":"An Easy Way to Retrieve Your Phone’s User Agent"},"content":{"rendered":"

\"FormWhenever 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 <\/span>or the Polaris browser found on the Helio Drift<\/span> 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<\/span>.<\/p>\n

I found my script to be a real time saver and think others might find it useful. Point your mobile or desktop browser at ua.yeswap.com<\/a> or ua.yeswap.mobi<\/a> to try it out.<\/p>\n

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<\/span> and Virgin Mobile<\/span> in the US.<\/p>\n

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<\/a> 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.<\/p>\n

Besides the User-Agent, my script also reports the Accept, Accept-Encoding, Accept-Language<\/span> and Accept-Charset <\/span>headers as well as the Via<\/span> header and any “X” headers<\/a>.  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 <\/a>file describing the device’s characteristics.<\/p>\n

Here are a couple examples of the script’s output:<\/p>\n

This is what my N95’s built in WebKit Browser sends:<\/p>\n

user-agent:<\/strong> 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
\naccept:<\/strong> text\/html,text\/css,multipart\/mixed,application\/java-archive, application\/java, application\/x-java-archive, text\/vnd.sun.j2me.app-descriptor, 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, *\/*
\naccept-language:<\/strong> en-us, en;q=1.0,fr-ca, fr;q=0.5,pt-br, pt;q=0.5,es;q=0.5
\naccept-charset:<\/strong> iso-8859-1, utf-8; q=0.7, *; q=0.7
\naccept-encoding:<\/strong> gzip, deflate, x-gzip, identity; q=0.9
\nx_nokia_musicshop_bearer:<\/strong> WLAN
\nx_nokia_musicshop_version: <\/strong>1.0.0
\nx_wap_profile: <\/strong>\"http:\/\/nds1.nds.nokia.com\/uaprof\/NN95-3r100.xml\"<\/code><\/p>\n

These are the headers sent by the same phone using Opera Mini:<\/p>\n

user-agent:<\/strong> Opera\/9.50 (J2ME\/MIDP; Opera Mini\/4.2.13216\/428; U; en)
\naccept:<\/strong> text\/html, application\/xml;q=0.9, application\/xhtml+xml, image\/png, image\/jpeg, image\/gif, image\/x-xbitmap, *\/*;q=0.1
\naccept-language: <\/strong>en,en;q=0.9
\naccept-charset:<\/strong> iso-8859-1, utf-8, utf-16, *;q=0.1
\naccept-encoding:<\/strong> deflate, gzip, x-gzip, identity, *;q=0
\nx_forwarded_for:<\/strong> 32.156.216.83
\nx_operamini_features:<\/strong> advanced, file_system, folding
\nx_operamini_phone:<\/strong> Nokia # N95
\nx_operamini_phone_ua:<\/strong> 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<\/code><\/p>\n

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.<\/p>\n

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  Spamgourmet.com<\/a> or Yahoo Mail’s Addressguard<\/a>.<\/p>\n

If you are a yeswap.com<\/a> or wapreview.mobi<\/a> user, I’ve added a link to ua.yeswap.com<\/a> labeled “View User-Agent” in the Technology\/Mobile\/MobileTech<\/span> section of both mobile sites for your convenience.<\/p>\n","protected":false},"excerpt":{"rendered":"

Whenever 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 … Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":22230,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[51],"tags":[494,492,493],"_links":{"self":[{"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/posts\/2092"}],"collection":[{"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/comments?post=2092"}],"version-history":[{"count":10,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/posts\/2092\/revisions"}],"predecessor-version":[{"id":22229,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/posts\/2092\/revisions\/22229"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/media\/22230"}],"wp:attachment":[{"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/media?parent=2092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/categories?post=2092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wapreview.com\/wp-json\/wp\/v2\/tags?post=2092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}