User Agent Man

April 9th, 2011

I don’t know about you, but I just love browsing the mobile web on my development machine. The minimalism is so striking. It’s so refreshing to view things from a mobile device perspective in today’s content- and graphic-laden Internet…. Since sarcasm is so hard to notice on the Internet, I’ll tell it like it is: I’m being sarcastic.

That being said, sometimes it is necessary to view a website you are developing from a mobile perspective. I am a huge fan of websites that are mobile friendly. There are two main ways of making a website mobile friendly:

1. Considering mobile browsers in your initial design

2. Building a mobile version of your site specifically for mobile browsers

I like sites that provide both. An example of option one is making sure that any dropdown menus are functional on a mobile device. Most mobile devices don’t have a means to hover a pointer over an element like a desktop mouse. An example of option two is the Volvo Rents Construction Equipment website. Visiting www.volvorents.com in a browser will result in two different websites based on whether or not you are using a mobile device.

This functionality is built on something called a user agent. To see your current user agent visit http://whatsmyuseragent.com. While that long string of names and numbers might not mean a lot to you, a developer can harness that user agent in order to provide two very different experiences to users of a site.

Now, let’s get a little technical. I develop, work, and live (during my workday) in the Chromium browser, the open-source version of the Google Chrome browser. If I want to check the features and display of a mobile version of a website, I can launch Chromium or Google Chrome from the terminal and tell it what user agent to use.

This launch flag/command line option is extremely useful. I encourage you to try it out. Start up a terminal and run one of the above commands respective to the browser you have installed. Go ahead, you can use my phone’s user agent. I don’t mind. Once you have the browser running, visit www.volvorents.com and see what you get. Several other sites you can visit and play around with a mobile user agent are Facebook, Amazon, NFL, ESPN.

To see a large list of different user agents, visit: http://www.user-agents.org/ You can use the user agents listed on that site to see what it’s like to browse the web as a robot.

Colin Foley

Colin's programming career began in high school where he began to learn the ins and outs of the Java language. While attending Lehigh University, he focused his efforts on web development. Ever since then, the majority of his work experience has been developing websites with PHP, MySQL, Adobe ColdFusion, J2EE, HTML and CSS.