User Agents
Friday August 22, 2008
JavaScript browser sensing is useless.
When you code your JavaScript what you are interested in is whether the browser being used supports the code or not. This can be most easily tested using feature sensing to see if the browser supports the specific code you are trying to use. That way it doesn't require you to update the script for the new browser versions released each day.
The way people used to check for support was to use browser sensing to work out which browser it is. Not only does such code require updating to cater for new browser versions that support code that wasn't supported before but there is also no foolproof way of identifying a specific browser. The information on which browser it is comes from a field called the User Agent. The following article explains how you can easily modify the user agent in various web browsers to have them identify themselves as a different browser or in some cases as anything at all which makes such testing completely useless.
User Agents


No comments yet. Leave a Comment