httpheaders.com
:: overview :: header fields :: header viewer :: articles :: links :: contact :: home :: 
Articles

HTTP Headers And Browser Detection

Knowing what software is being used to view your site may seem trivial, however, it can be very useful. If 99% of your users are using Netscape 6.2, then you should probably make sure that your site works well in that version of Netscape.

By sniffing the User-Agent field in server side scripts or using a product like BrowserHawk you can easily detect the browser and operating system being used. This becomes helpful when you want to serve content based upon the browser and OS of someone viewing your site. Maybe you want to serve a "Hi-fi" version of your site to everyone using Internet Explorer 5.0 and above and a "Lo-fi" version to all the other IE browsers. (Here is a tutorial on detecting the user's browser and serving content based on that information).

For example, the User-Agent string that your browser is sending to our server is:

CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

There is a problem with the User-Agent string in that there are certain browsers that let the user change this header field. However, even if a few people do change their User-Agent header to something that does not represent what browser they are using, it's not that big of a deal. You can still get a good idea of what browsers are being used to view your site from the rest of the users.


[ overview ] [ header fields ] [ header viewer ] [ articles ] [ links ] [ contact ] [ home ]
info@httpheaders.com
© 2002-2009 HTTPheaders.com