USER-AGENT DETECTION
User-agent detection uses the browser's user-agent string to determine information about the browser being used. The user-agent string is sent as a response header for every HTTP request and is made accessible in JavaScript through navigator.userAgent
. On the server side, it is a common and accepted practice to look at the user-agent string to determine the browser being used and to act accordingly. On the client side, however, user-agent detection should be assumed to be unreliable and used in scenarios when other options are infeasible.
Among the controversial aspects of the user-agent string is its long history of spoofing, when browsers try to fool servers by including erroneous or misleading information in their user-agent string. To understand this problem, it's necessary to take a look back at how the user-agent string has evolved since the Web first appeared.
History of User-Agent Composition
The HTTP specification, both versions 1.0 and 1.1, indicates...