My smartphone sports a dual-core processor

So, I was wondering what my blog looked like when viewed with a mobile device. I could have just dragged out a smartphone and looked at it, but I decided to be a little adventurous.

As it turns out, the way most websites determine what version of a web site to load for someone is through a string called a user agent string, which of course details the operating environment some client is running under. Kicker is, the server has no way of knowing itself - it is only by the good graces of the client that the server knows what all to do about the device that just connected up to it and asked for a web page.

The more astute among you out there might imagine, if you had full control over the entire web request, you can tell a site anything you want, and (for the most part) they have to take you at face value. So, if I tell Hatena I'm surfing it up on my Android, it'll send me the mobile version of its site for the Android. Now of course there's ways around this from a server perspective, but as far as I know, it involves breaking the entire site for a specific range of browsers or devices... not really in a site's best interests.

So, I surfed it up on my PC, and came up with the following.

http://spoofer-extension.appspot.com/

This handy little app installs itself onto Google Chrome, and allows you to switch your user agent. It actually comes with some preset definitions, like a user agent string for Android phones.

Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13

Install it, and a new little icon appears in Chrome that allows you to switch, on the fly, what user agent you appear to be for any site. Want to access a smartphone only site, but don't have a smartphone? Well, all you gotta to is ask!

There are other such extensions for other browsers - I know Firefox has one at the very least, and some browsers (such as Slepnir) just come with this functionality. The only thing is that you're viewing the mobile version of a site with a full-sized monitor, so some things look ugly. Also, touch screen controls... aren't the best in the world, either.

For Chrome in particular, you can invoke this behavior from the command line, too. The command option is --user-agent="".

And for the record, my blog doesn't look that exciting when viewed from a smartphone.