Team LiB
Previous Section Next Section

Browser Detection in Practice

There are a few problems using browser detection the way it has been described up to this point. First, you must make sure JavaScript can even be executed; you may want to do some basic browser detection using server-side technologies that look at the user-agent string and then probe more deeply using JavaScript, if it is available. Another problem is that, so far, all the hard detection work is carried out anew for each page the user loads. Ideally, you should save this information to a cookie and then detect only those features that have changed. You will also have to make sure your detection capabilities are failure-proof by considering all the things that could go wrong: scripting being off, a new browser version hitting the market, and so on. Last, you’ll have to be a browser capabilities expert, which is difficult given the number of browsers currently in use. Just counting the major versions of major browsers, there are literally dozens of distinct browsers commonly used, and there is a great deal of information to deal with, especially considering older browsers and the emerging device-based browsers on cell phones and PDAs. Fortunately, help is out there. Consider looking into browser detection such as BrowserHawk (www.browserhawk.com).


Team LiB
Previous Section Next Section