Saturday 19 March 2011

Broswer Detection

A lot of sites these days rely on client side scripting language Javascript.

A great framework to create rich user experiences on the web.

The problem with this is well known: broswer implementations of Javascript differ from the standards and from each other.

It is for this very reason that makes browser detection unreliable.

In effect the problem itself recursively makes the solution unobtainable. WHAAAT???

What i mean is: detecting the browser correctly relies on that same browser implementing some sort of function which tells you its identity. Now if every browser wrote a different function to do this, you would need to know what that function is in advance in order to call it.

Therefore, your code will never cater for anything new unless it happens to implement the identity function in the same way as another browser that you already cater for.

The solution options:

1. Choose which broswers to support and stay up to date with their implementations of the identity functions. Use these functions to identify the chosen broswers your supporting and tell everything else that they:
a. Can't use the site until they update
OR
b. Can use the site with the acknowledgement that it may not function correclty.

2. Write a script which attempts to capture all current browsers implementations of the identity functions. If user has a browser outside of your supported set, let them know what their browser has identified itself as and they:
a. Can't use the site until they update
OR
b. Can use the site with the acknowledgement that it may not function correclty.

Peter-Paul Koch has written a sophisticated broswer detection script - Click Here To See.

No comments:

Post a Comment