IE7 User Agent String published

The IE7 hackers (the ones at Microsoft hacking on the real IE7, that is, not Dean Edwards :) ) have revealed that IE7′s user agent string will be “Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)”.

Those of you who are thinking, so? who cares about user agent strings? should give yourselves a pat on the back. We, the web developers of the world, should not care about them. Using the user agent string to sniff for browsers is very bad, and you should not do it; use feature sniffing instead, where you test for the features that you want to use. Don’t test the user agent string. It’s a bit concerning to me that the IE team are releasing details of the user agent string this early on, because that at least implies that they are expecting people to start testing for it, and that makes them surprisingly out of touch with the way we should be doing things. That’s surprising because they are clueful guys over there (yes, they are, stop the snarky comments), and it would be much more useful to know whether, say, CSS hacks that people are currently using to exclude IE will continue to work.

Still, at least you can now start checking your server access logs to see if people with IE7 are browsing your website.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • http://boyohazard.net Octal

    Using the user agent string to sniff for browsers is very bad…use feature sniffing instead

    Could’t agree more.

    No IE7 in our logs yet.

  • http://www.adamthody.com thody

    Seems like the development is really moving along. It’s come a long way since the browser was announced a few weeks ago…I wonder if they were working on it long before, or if they’re trail blazing. If it’s the latter I hope they slow down and do it right…we’ve already waited this long.

  • Craig

    Not sure whether I’m or happy or sad to see there is no “like Gecko” in the string…

  • http://www.baekdal.com baekdal

    Ahh… but it is important. There are some applications out there that need browser sniffing.

    To name one: Website Statistics Applications

    The user agent string is what you use to identify how many users visits your site with a particular browser.

  • http://www.sitepoint.com/ Kevin Yank

    It’s worth noting the final release will contain the version number 7.0, not 7.0b, which will be used for the beta.

  • sil

    Baekdal: very true. That’s why I said “Still, at least you can now start checking your server access logs to see if people with IE7 are browsing your website.”

  • Nicolas Chachereau

    Well, I think they told the world about their User Agent String because they know there are many people who don’t use good, standard, forward-thinking solutions and are still doing browser sniffing (Hey! Wake up! It’s 2005!). So, I wouldn’t say they are “out of touch with the way we should be doing things”. But you’re right, I hope they will release a list about the CSS hacks, too.

  • Val

    While I agree that feature detection is far preferable, there are many cases in which you need to know the browser, too. Some errors come not from lack of a feature, but from the fact the feature behaves differently in Browser Z than it does in Browsers X and Y. So “feature = getSomeWeirdFeature();” might evaluate to TRUE, and yet STILL cause problems, unless you say “feature = (getSomeWeirdFeature() && browser != ‘someBuggyBrowser’;”.

    The Box Model is a good case in point — IE did allocate margins and padding, they just did it the wrong way. One way to get around it — without bizarre CSS hacks — is to detect the UA and generate different code to accommodate it.

  • http://nathanwwong.com someonewhois

    I think I’ll change my user agent to this just to confuse people. At least then it’ll have some use to the tech world. ;)

  • MrBester

    As to Website Stats applications, they too should have known better than to rely on UA strings a long time ago (like whwn Opera first appeared with the ability to spoof put in a menu). For the most part there are other headers that would work better (like HTTP_ACCEPT) that are less likely to be inaccurate. Except for IE which sends */* (Safari does the same but it means it). As noted on a post on neowin you’d then have to fall back on the UA in this case (who alters IE’s UA?) to differentiate. There would have to be other “sneaky” checks to properly identify the browser, but it is possible.

  • Bruce

    Why don’t we ask them to put something useful in the headers? Like screen resolution, DPI, color depth, are cookies enabled, is Javascript enabled – if yes, what version, is CSS enabled, are images enabled, etc. If the header had that sort of stuff, it would eliminate half the hacks I do now.

  • CybrMaster

    The thing I want to see is that they have fixed png transparency display. How is it that this”upstart” Firefox can perfectly display transparent images and IE cannot if the developers at Microshaft are so, as you say…”clueful”?
    This is important due to the size differential for high-quality images. Transparent imaging gives much greater utility your image library. While you may be able to get transparency with GIF formats, the quality of the pic suffers.

  • Anonymous

    What I find interesting about this string is that it starts with Mozilla/4.0. Why would microsoft start their user agent string with the name of another company? Are they trying to say that Mozilla won’t catch up with the new IE until it reaches version 4?

  • Zach

    Because Netscape was using Mozilla in their string way way back, and other companies almost had to put Mozilla in their useragent string if they wanted their browser to have a chance to work. IE started using Mozilla in their Useragent with IE2 – obviously way before Netscape spinned off its browser into the Mozilla project. Its kept now because god knows what would break if the changed it.

  • Eeve

    I for one will HAVE to test for the user agent string. The cursed IE7 will be showing a very frightening and intrusive warning message when you try to visit a page that uses a self-signed or shared SSL certificate. So, since my client can’t afford a personal cert, I have to test for IE7 and then present some instructions that say- don’t worry about the warning- accept the certificate permenantly.

    The useragent string remains important as long as Microsoft keeps doing stupid things with their browser.