User Agent Man

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. 1. Considering mobile browsers in your initial design
  2. 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.

$ chromium-browser --user-agent="Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; DROIDX Build/VZW) AppleWebKit/530.17 (KHTML, like Gecko) Version/530.17 480X854 motorola DROIDX"
$ google-chrome --user-agent="Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; DROIDX Build/VZW) AppleWebKit/530.17 (KHTML, like Gecko) Version/530.17 480X854 motorola DROIDX"

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 FacebookAmazon, 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.

Robot

Colin Foley

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Search

Recent Posts

Tags