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:
- A developer creates a website in browser X then tests it in browser Y.
- Browser Y fails, so the developer writes browser Y detection routines and serves different code. Everyone is happy.
- Browser Y is then updated — but the website now fails because it’s serving legacy code.
- 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)
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
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.