As announced in February 2008, Internet Explorer 8 sends an updated user-agent string when interacting with web servers. Since we last blogged about the User-Agent string, the Internet Explorer team introduced Compatibility View and today, the Windows team is releasing the Windows 7 Beta. Each of these events has a small impact on the User-Agent string, as I will outline in this post.
The Trident/4.0 User-Agent String
In order to help users visit sites that block the “MSIE 8.0” user-agent string, IE8 will send the “MSIE 7.0” version information when viewing sites with Compatibility View enabled. As Scott described last August, a new “Trident” token in the User-Agent string allows your code to detect Internet Explorer 8 clients even when they are using the Compatibility View feature.
IE8 on Windows Vista (Compatibility View)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)
IE8 on Windows Vista
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)
As noted in the Best Practices for detecting the IE version, we recommend that web developers do not block access to content based on the user-agent string of the browser. If you must offer different content to different versions of the browser due to improved capabilities, you should ensure that future versions of the browser are not blocked.
Serving content based solely on the user-agent string is often an unreliable way to detect the full capabilities of the browser, because the user might have adjusted some settings, such as disabling script or extensions.
The Windows 7 User-Agent String
On Windows 7, IE8 will send the User-Agent string with the new Windows NT version token.
IE8 on Windows 7
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)
(If you’re curious about why Windows 7 uses the version number “6.1”: the short answer is that it improves compatibility, and the longer answer can be found over on the Windows Team Blog.)
Nevertheless, the “Windows NT 6.1” version token may still result in problems for a very small number of websites that check the operating system version. Such websites may show error messages or otherwise interrupt visitors who are running Internet Explorer 8 on Windows 7. The Compatibility View button will not resolve this problem for such sites, because the Compatibility View button only changes the Internet Explorer version number, leaving the Windows version number intact.
In order for IE8 users on Windows 7 to visit websites which block the “Windows NT 6.1” version string, a registry override must be set to temporarily change the reported Windows version number. If you encounter any websites that block Windows 7 visitors, please submit a bug report on Connect or provide the URL of the site in the comments below.
Detecting 64-bit Internet Explorer
As machines with more than 4 gigabytes of RAM become more common, more and more users are running 64-bit versions of Windows. For compatibility with 3rd party add-ons, the 32-bit edition of Internet Explorer remains the default on 64-bit systems. However, in some cases it can be useful for websites to recognize when users are visiting using 64-bit systems—for instance, a site may want to know whether to offer a 64-bit executable download.
Tokens in the User-Agent string will enable you to determine whether or not the user is running a 64-bit version of Windows, and whether they are running the 64-bit edition of Internet Explorer.
64-bit IE on 64-bit Windows:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0)
32-bit IE on 64-bit Windows:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0)
Incidentally, WOW64 stands for “Windows on Windows 64-bit.”
Extending the User-Agent String
As described in the MSDN article Understanding User-Agent Strings, it is possible for users or applications to add new tokens to the User-Agent string by setting registry keys. We strongly encourage discretion in adding additional tokens, as the network overhead can become measurable as the string grows. Remember, the User-Agent string is sent in the headers for every HTTP/HTTPS request from the browser (and applications based on the IE Web Browser Control), so if you must add a token, please keep it as short as possible. We have also encountered some websites that do not function if the user-agent string is unusually long (for instance, over 128 characters).
You can check the User-Agent string your browser is currently sending here.
Update 12:37: correcting formating of titles in post.
Published Friday, January 09, 2009 12:17 PM by ieblog
Filed under: Developers, Compatibility
In order to help users visit sites that block the “MSIE 8.0” user-agent string,
I know this from some other place :whistle: