Fortunately, people were thinking ahead when they wrote the HTTP specification.
Section 14.42 of the HTTP 1.1 spec designates a special header called User Agent, which is to be used for identifying the Web client to the server. Don't ask me why they didn't call it the Web Client header. Perhaps they just got back from a 007 film festival.
The point is that your Web server can use this header to decipher what kind of browser is making a request and then act accordingly. For example, a recent version of Internet Explorer running on a Windows 98 box sends a User Agent header string that looks like this:
User Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
Netscape running on a Mac might send one like this: User Agent: Mozilla/4.5 (Macintosh; U; PPC)
And FYI, it appears that the browser you're currently using to view this document sends this User Agent string: WebCopier v3.2a
It's rare to come across long lists of possible User Agent strings on the Web, but it's easy enough to make your own if you know a little Perl and your server is set up to record them in its logs. If you actually perform this little surveillance experiment, you might be surprised to see how many different variations there are.
And therein lies the difficulty of getting the info you want out of the User Agent.
next page»