Tuesday 24 February 2009

What's YOUR Browser?

I’ve spent the weekend trying to do something ostensibly rather simple; to wit, trying to make my website more accessible on mobile phones and similar devices. The actual work is fairly simple - just providing alternative pages which are smaller and generally less flashy, but still contain the same data. The only trick is for the web site to be able to determine whether it actually is being accessed by a mobile device or a full-blown browser, so that it can decide which version of the page to send back.

There’s a standard mechanism for this. When the browser makes its request it sends the web server a string (referred to as a User Agent) which, in simple terms, identifies the browser, but does not explicitly say whether it is a mobile browser, or provide any other detailed information. Back on the web server, there is a list of browser capabilities, and the web server looks through this list until it finds an entry matching the string sent from the browser. From that entry, it can see whether the browser is on a mobile device, what the screen width and height are, and much more besides. If it doesn’t find an exact match, it goes for the closest one it can find.

The problem is that this list of browsers has to be kept up to date - and generally it isn’t. For example, many web sites (I would guess most) incorrectly identify Google’s Chrome browser as Apple’s Safari - Chrome is, after all, relatively new on the scene. In this case, the differences don’t matter much, but more significant is the fact that a plethora of mobile browsers are identified as fully capable desktop browsers, simply because the browser capabilities list is unaware of their existence.

Ultimately, no one has taken responsibility to maintain a distributable, up-to-date list of browsers. Microsoft don’t, and even if they did, it would only work for sites that run ASP.Net - the Microsoft website technology. PHP users would still have to manage their own list (although conversion from one to the other should be petty straightforward). The are some not-for-profit sites that try to maintain lists, such as http://owenbrady.net/browsercaps/, but it’s  matter of luck and dedication if these are up-to-date. There are also commercial products that provide the information, but they are too pricey for anything but serious commercial sites.

The people who have the knowledge, the ability and, ultimately, the motivation to make this information widely available are the browser manufacturers themselves. The more website designers can tailor their sites to specific browsers, the better the browsers look.

So come on browser manufacturers, pull your socks up. Send me your User Agent strings and your browsers capabilities, in any or all formats, an I’ll put together a website to make sure all web developers can access them. And then we’ll all be happy.

Send your browser capabilities to software@jasperkent.com.

No comments:

Post a Comment