A quick note on the Beta 2 Preview user agent string

The information published in this post is now out-of-date and one or more links are invalid.

—IEBlog Editor, 17 September 2012

At the end of April of last year, we blogged about the new Internet Explorer 7 User Agent string.  Since our original blog posting, we have also posted two new articles on this topic to MSDN: Understanding User-Agent Strings, and Best Practices for detecting the Internet Explorer version.

I’d like to provide a quick update to this topic for the Beta 2 preview version of IE7.

For the Beta 2 preview, we’ve removed the “b” from the user agent string.  We made this change early in order to help accommodate some sites which were mistakenly trying to cast the HTTPBrowserCapabilities.Version string property to a float. This cast throws an exception if the “b” is present in the string.  (For completeness, we’ve also updated the MSDN documentation for this property to help clarify that this property cannot be blindly cast to a number.)

With the removal of the “b”, most Internet sites are viewable in IE7, although there are a few sites which fail to recognize IE7 because they are performing exact string matches to look for specific IE version strings.  Those checks will need to be removed or updated to accommodate IE7.  The Best Practice document linked above provides suggestions.

If you need to be able to detect the IE7 beta version, you can still use conditional comments, because conditional comments do not evaluate the User-Agent header.  Instead, conditional comments are evaluated against IE’s Version Vector, which still contains the “b”. 

Hence, the following code will generate appropriate text, depending on whether or not the user is running a beta or final build:

          <!--[if IE 7.0b]>
<p>Conditional comments indicate that you are using a beta version of Internet Explorer 7.0.</p>
<![endif]-->

 

          <!--[if IE 7.0]>
<p>Conditional comments indicate that you are using the final version of Internet Explorer 7.0.</p>
<![endif]-->

You can use a simple User-Agent string test page to view your current user-agent string.  The page also provides simple registry scripts to override the user-agent string to help simulate different IE versions.

To summarize:

  • IE7 running on Windows Vista will send the following User-Agent header: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
  • IE7 running on Windows XP SP2 will send the following User-Agent header: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

Happy beta-testing!

 - Eric Lawrence