What Looks Like IE11 but Smells Like Firefox?

By Craig Buckler
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

A pre-release build of Windows Blue, Microsoft’s successor to Windows 8, was leaked a few days ago. It may have been intentional or unintentional but the OS was installed, dissected and reported across the web.

The new OS contained an early version of Internet Explorer 11. A very early version. Probably nearer IE10.01. There’s little new technology to report, but one update caused a storm of controversy on SlashDot and Neowin.net: IE11’s user agent string appears to impersonate Firefox…

Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko

The ‘MSIE’ string has disappeared and a suspicious ‘like Gecko’ statement has appeared. Cue 1,000 conspiracy theories.

Historically, browser vendors and developers have been doing the user agent dance since the dawn of the web. The problem starts when you attempt to create a cross-browser compatible website:

  1. A developer creates a website in browser X then tests it in browser Y.
  2. Browser Y fails, so the developer writes browser Y detection routines and serves different code. Everyone is happy.
  3. Browser Y is then updated — but the website now fails because it’s serving legacy code.
  4. The vendor changes the user agent string: detection fails and the site works again. Everyone is happy and we loop back to step one.

Look at the start of IE11’s user agent string: Mozilla/5.0. The early versions of IE had to masquerade as Netscape because it was the dominant browser and many sites refused to return content to anything else. The situation continues today — IE, Chrome, Safari and Firefox all start with ‘Mozilla/5.0’…

Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)

Chrome 25:
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22

iPad Safari 6:
Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25

Firefox 19:
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0

You’ll also notice both Chrome and Safari use the same ‘like Gecko’ string as IE11. I don’t recall that bombshell hitting the headlines?

The biggest change in IE11 is the removal of ‘MSIE’. I suspect that has been done for one reason: to prevent sites serving invalid IE6/7/8 code to modern editions of the browser. Recent releases of IE’s Trident engine are closer to Gecko or WebKit than legacy editions of itself. By removing the ‘MSIE’ string, Microsoft is breaking detection code and making many sites work as they should.

The point is: none of this matters. If you’re browser sniffing, you are almost certainly doing something wrong! While it seems an obvious solution, browser sniffing is a fragile technique that introduces more maintenance headaches than it prevents. If you know someone who sniffs, please suggest they close their IDE, step away from their browser and embark on another career.

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • Ben

    Browser sniffing can do things feature detection can’t.

    Oh, IE7, you want to clip the height of this button, but IE8 does it fine! Ok, browser sniff to fix that one in IE7! Can’t do that with feature detection alone, unless you detect a feature that only IE7 doesn;t have lol in which case you’re doing essentially the same thing.

    • Why do you need to browser sniff? If you really want buttons to look absolutely identical in all browsers, then use an image and be done with it. However…

      1. Pixel perfection is futile. Don’t even try.
      2. Using browser detection to implement pixel perfection is so wrong that a web pixie just died!

    • David

      Then you use conditional comments in CSS to fix that:

      According to the conditional comment this is IE 7

      Everything else should still be feature detection as you can change the user agent at will.

      • David

        Ugh. Guess the comments strip out the html comments

      • Yep – that’s a reasonable solution although, personally, I’ve never liked CCs because it always felt a little too much like sniffing.

        In this particular case, though, we’re talking about a 7 year-old browser with a 1% market share. Who cares if the buttons are slightly bigger — they still work!

      • Rob

        “In this particular case, though, we’re talking about a 7 year-old browser with a 1% market share. Who cares if the buttons are slightly bigger — they still work!”

        Unfortunately I have done some freelance work for a company that rolled out web-based software to UK councils. You’ve guessed it, even now in 2013 many of them still run XP with IE6 and the council workers are often not allowed to upgrade or install a different browser. And yes, they demand pixel-perfection, not only for IE6 but for every browser on the planet so the end-user can use it from home too. Much of the markup and CSS for the underlying system is hard-coded in, sometimes with !important, and I had to go in and make the theme work… cue much weeping.

        Admittedly this is (hopefully) a rare case but browser sniffing was essential to get anything working.

      • Hmm, OK, but anyone expecting pixel-perfection between a modern and a 12 year-old browser will be disappointed. Even fonts will render differently on different browsers on the same OS.

        This sounds more like a client education issue. That said, it’s possible to get IE6 to produce something close to a modern browser experience, it’s just that you need to convert almost everything to graphics. You still don’t need to sniff UA strings.

  • Ignoring the topic of whether browser sniffing is good or bad, it exists and it’s been used/abused for years. There are plenty of sites out there doing it. I think this is a very sensible move on Microsoft’s part, sites which rely on browser sniffing will still work in older versions of IE and they’ll work in IE11 as well. It’s best for everyone involved: lazy developers won’t need to deal with “My site has broken” calls from clients after they upgrade their browser, end users will see sites as they were intended and Microsoft won’t take a reputation hit because “IE11 breaks existing sites”.

  • Andrew

    It’s nice to be at a point where you don’t have to be tempted into using conditionals or sniffing because browser standards are so vastly different.

    • Aren’t we there now?

      In the past I avoided CCs and fixed legacy IEs issues (the odd hasLayout or position:relative worked wonders). Today, I don’t bother but may use RWD techniques to apply a simpler template.

      As for UA sniffing, I recall using it once in the past 10 years — and even that was a one-line fix for a minor issue which solved a problem in older versions of Opera.

      You don’t need to sniff: most browsers smell the same.

  • Erick G

    «If you know someone who sniffs, please suggest they close their IDE, step away from their browser and embark on another career.»

    So if I don’t think like you on this topic I don’t deserve my job? What???

    Glad to see that you have been born into this world as the supreme Keeper of the Truth: you’re so hot as a consultant (!!!) that you certainly know ALL the situations that ALL the coders will have to face in their career…

    • Are you saying you don’t agree? If not, why? Browser sniffing has been widely rejected as a viable technique since the late 1990s.

      What issues have you encountered where browser sniffing was essential? Statistics collation is perhaps the only justified use.

      • Ryan

        I use the tried and true method of its not really browser sniffing so much as, if you are using IE I need to load another 200kb of styles so that it actually looks right for you. If IE would just follow and support the same standards, it wouldn’t have to go around masquerading.

      • 200kb of extra styles for IE? Perhaps a slight exaggeration, but IE10 has almost identical support for standards as Firefox and Chrome. IE9 isn’t far off, but you will be missing some effects such as text-shadow. IE8 is normally well behaved but won’t look as pretty.

        Are you still supporting IE6 and 7? If so, test early, test often and don’t expect a 12 year old browser to do everything well.

  • Mkv

    We are doing browser sniffing for very good reasons on a moderately busy music site. Reasons:

    – We cannot rely on Flash any more so we are using Flash AND HTML5 and use HTML5 whenever possible. We have a Javascript-powered playing environment which we need for many reasons.

    – Practically all modern browsers play media without any extra modules. But: IE7, IE8 will not. They need a browser plugin (Flash player).

    – But Firefox and Opera do not play MP3 and never will. IE and Safari will not play OGG .

    – Therefore we MUST figure out whether the browser is HTML5 capable and what media format it will support. After sniffing we know which player to use (Flash or HTML5) and which audio format to use.

    So browser sniffing is absolutely necessary even today.

    • Media is complex, but there shouldn’t be a reason to browser sniff.

      HTML5 supports multiple file sources — the browser will pick the media it needs. In the case of IE6/7/8, you’ll need to detect for audio support using object detection, e.g.

      var audioEnabled = !!(document.createElement(‘audio’).canPlayType);

      If that variable returns false, you can load a Flash alternative.

      The key is: use object detection — not browser sniffing.

  • Microsoft has realised its loss in the market dominance of IE6, but still failed to provide a matching alternative to Firefox and Chrome in the recent years. The MSIE removal can be a sign that finally, IE11 may be fully compliant with standards. Remember the time when IE9 came, and a lot if IE-only code has to be changed? They might want to avoid something like that.

    • If “a lot of IE-only code had to be changed” in IE9 that was because it was significantly more standards-compliant than earlier versions and supported HTML5. That said, I don’t recall updating a single site. IE8 had reasonable standards support but was primarily missing CSS3 effects which degraded gracefully.

      In most cases, IE10 is as good as Firefox, Chrome or Safari. Not ahead perhaps, but at least keeping reasonable pace.

  • Agree with Craig, all the necessary things can be done without browser sniffing.

  • “If you know someone who sniffs, please suggest they close their IDE, step away from their browser and embark on another career.”

    That statement really got me laughing. Reading through the comments I see it has actually touched
    some nerves.

  • Gecko is not suspicious. It is the open source browser engine designed to support open Internet standards such as HTML 4, CSS 1 and 2, the W3C DOM, XML, JavaScript, and others. More info at: https://developer.mozilla.org/en-US/docs/Gecko/FAQ

    • Hi Chankey. I think you may have read that statement a little out of context. I was referring to the fact that “like Gecko” has appeared in IE11’s UA string — not that Gecko is suspicious in some way.

  • I’m a web coder…and lazy, by my own nature! (And notice I didn’t say all web coders were lazy, I said I was lazy so you can stop the aghast expressions and jaw-drops.) I have no desire to sniff browsers and never have. When I first started building websites nearly a decade ago, HTML and CSS was hard and janky; then we had the whole JavaScript resurgence to start navigating and manipulating the DOM, forcing coders into even more bizarre multiple configurations for browsers. And oft-times our sites still look or act like crap.

    What I find most aggravating is that Microsoft just simply can’t wait to make sensible, STABLE releases of their browser technologies. They rush their stuff into the marketplace trying to keep up with every other vendor who, for the most part, isn’t doing it right either. (Have you seen the performance of IE10 on Windows 7? It SUCKS!).

    Maybe I’m completely off track, but here’s a thought: why don’t we get off our collective duffs, pull together, and make browsers that just simply work? Otherwise we might as well just stick to server-side code and keep things as simple as possible in the arena of the UI, instead of relying on browser sniffing to slow us all down to a dinosaur-era crawl.

    • Isn’t every vendor making “browsers that just simply work”? And I really don’t think Microsoft’s typical 18-24 month time between versions is “rushing”?

      Browsers are closer than they’ve ever been. It’s taking too long for old IEs to die but, even if you need to support them, there’s still no need to browser sniff.

      • Thanks, Craig, but no — I don’t feel every vendor is making browsers that just work because if they were we wouldn’t have to go to such lengths to support cross-browser compatibility (which is the entire cause of the browser-sniffing phenom to begin with, is it not?)

        You’re absolutely right, it IS taking too long for old IEs to die out–that’s because the newer browser releases simply aren’t cutting it. That’s what I mean by rushing: MS tends to not do as much testing as they probably should before laying it on us.

      • Are we going to such great lengths? I admit video can be a pain, but all the mainstream browsers have a great level of standards support. Unless you’re using a cutting-edge technology, you rarely encounter cross-browser issues.

        I’ve not had problems with IE10. IE9 was mostly fine and even IE8 wasn’t too horrendous if you’re happy to live without CSS3 effects. What have you experienced?

      • I admit to not having any issues with IE8 (it handled CSS2.1 and JS quite elegantly), and I was personally happy with IE9 on Win7. As to IE10, the experience was less than stellar. Drop down menus definitely changed in they way they performed and rendered, particularly adopting that Metro UI look. Some our internal and external vendor web apps (like our timecard system) using JavaScript menus would no longer function at all! Issues were also encountered with use of the browser and our biometric devices (Eiko thumb-readers, for example), where the user name would no longer auto-populate for the Outlook.com site, for example. This was most likely to the textbox watermark (again, JavaScript). We also had a lot of users experience slow performance rendering the browser, if it didn’t crash altogether. So yeah: we had a few issues with IE10 that I think were largely related to defects in its SDLC.

      • Did the problems occur in IE10 desktop as well as Metro view?

  • I think the only time I’ve ever *had* to user UA string sniffing was an issue where IE wasn’t sending Accept headers (or maybe it was just sending */*) when refreshing a page.

    However, I do use IE conditional comments and CSS hacks quite a bit. I think you need to bear in mind that just because IE 6-7 has 1% market share and you don’t care if the website looks messed up on them, not all of us are in the same position. Some of use see much higher usage of IE 6 and 7 on our sites, and so it is worth making some extra effort (within reason) to make sure a site works correctly in them.

    • You can make IE6/7 look reasonable without CCs or hacks — it’s just that you need an unhealthy knowledge of the bugs and quirks.. For example, “display:inline;” is valid CSS and fixes the IE6 double-margin float bug.

      I’m just not convinced it’s necessary when you can use RWD techniques to offer legacy browsers a simpler layout which won’t have issues in the first place.

  • Adamantus

    Microsoft is at it again, must be the same developer who came up with IE6. Why don’t they just sack that guy?

    I just wonder whether Microsoft is attracting bad people. IE is completely uncool to anyone with an IT degree, no one in their right mind would want to work in that department in Microsoft.

  • Grumpy old stodger

    All this angst and teeth gnashing over the differences between IE8 and IE10 with a dash of IE6 thrown in!

    When I was a lad, we were coding for Netscape 3 and IE3. OnMouseOver was a relevation if it worked, and all layouts were in tables. and they still worked differently.

    Young folk today have it easier than ever and are still not happy.

    If your client wants it to work in IE6, then help them to understand a) it will likely not look and work the same. This is not your fault. b) it will take more of your time, and more of their money for results. This is also not your fault.

    Other than that, vent away, I know clients are frustrating. Mine want curved corners on everything. Which would be easy if they didn’t want it in IE6 too. but they do, so cue the IE6 extra coding surcharge.