1. Home
  2. Computing & Technology
  3. JavaScript
photo of Stephen Chapman
Stephen's JavaScript Blog

By Stephen Chapman, About.com Guide to JavaScript since 2004

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
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.