Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
How To Determine Browser Type in Server-Side Script Without the BrowserType Object
Article ID: 272413 - View products that this article applies to.
This article was previously published under Q272413
There are two common methods in server-side script to determine information about the browser that is being used by the client:
167820IMPORTANT: The methods that are used in this article rely on the Web site receiving the correct "HTTP_USER_AGENT" string for browsers that connect to the site. Some proxy servers and browsers may send information that is incorrect or difficult to interpret. For example, the default HTTP_USER_AGENT string that Opera 5.12 returns is "Mozilla/4.0 (compatible; MSIE 5.0; <operating system>) Opera 5.12 [en]". This string is hard to interpret because the first portion of the string is the same as the string that Internet Explorer 5 returns.
(http://support.microsoft.com/kb/167820/EN-US/ )How To Determine Browser Version from a Script
If you need to uniquely identify Internet Explorer version 5 or later (on Microsoft Win32 and Unix platforms only), use the isComponentInstalled or getComponentVersion methods of the CLIENTCAPS behavior. For information about these methods, see the following Microsoft Web sites:
http://msdn2.microsoft.com/en-us/library/ms531357.aspxNOTE: These methods will fail if the client is not Internet Explorer 5 or later (Microsoft Win32 and Unix platforms only).
The following sample code illustrates the use of Request.ServerVariables("HTTP_USER_AGENT"):
In Microsoft Internet Explorer 5.0, this code returns the following data or similar:
This sample code uses the string that is returned for Internet Explorer, but there is no standard format for the string that a browser returns to the HTTP_USER_AGENT server variable. The complete list of possible values for HTTP_USER_AGENT is quite long, and new values are added each time that a browser is updated.
Here is a very brief sample of HTTP_USER_AGENT values:
To see samples of possible strings, search on your hard disk for a file named Browscap.ini, and open it in NotePad. Browscap.ini contains a list of values for Internet Explorer and Netscape Navigator, as well as browsers from Oracle and Opera. You can also download the most recent version of Browscap.ini from the following cyScape Web site:
Internet Explorer - Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) - Mozilla/4.0 (compatible; MSIE 4.0 Crawler; Windows 95) Netscape Navigator - Mozilla/4.0b1 (Win95; I) - Mozilla/3.01Gold (Macintosh; U; PPC)
http://www.cyscape.com/asp/browscapMicrosoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.