Friday, February 2, 2007

User Agent Switcher

If you do any mobile development, you should definitely get to know the User Agent Switcher add-on for Firefox. What does it do?

Well, when a browser sends a request for a webpage, it includes a string describing some information about who is sending the request (e.g., the browser name, version, etc.). Mobile browsers (well, most of them) send information about the device make, model, MIDP version, etc. Websites can use this information to decide what page to serve up (if any).

The User Agent Switcher add-on allows you to pretend that the request is coming from any device. This means you can see exactly what page would be served up if that device visited the website. How does it do this? By spoofing the user agent, of course. For example, if you want to see what a website would display if you hit it with a Nokia 6230i, you can have the User Agent Switcher send the following user agent: Nokia6230i/2.0 (03.23) Profile/MIDP-2.0 Configuration/CLDC-1.1

I won't go into details about how to use it - it's pretty simple. But, it can be extremely useful for debugging websites, especially those that only have issues on certain devices. There are lots of other nice tricks you can play with the User Agent Switcher to test and debug problems. I'll go into more details in a later post.

No comments: