Saturday, December 14, 2013

MSIE 11 - isnt

I got pretty upset when I was trying to figure out how to identify IE 11 from other browsers when trying to get a simple sound playing function to work on all browsers.
It turns out IE has decided in version 11 to lie about itself.
The userAgent string for IE11 no longer has the string "MSIE" in it - which has been there since it began.
Luckily, I did find a solution here.
But just because the magic of regular expressions comes to save the day doesn't excuse Microsoft for once again throwing yet another monkey-wrench into programming by lying.
The userAgent string has the express purpose of identifying to code what browser and version is running.  If you are viewing this on IE11 (which I am writing it on) and you select the help\about menu option, you will see it says "Internet Explorer 11" followed by a precise build number.
If you print the navigator.userAgent string you will find:

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

Now where do you see either "Internet Explorer/IE" or "version 11" in that string?  Well you can tell its MSIE because it says "Trident" and you can tell it's version 11 because it says "7.0" - simple right?
Most likely this change was decided upon because Microsoft has been trying to better emulate Firefox and this userAgent string is so much like a Firefox userAgent string as to fool existing code.
But IE is not Firefox and I know for a fact that there are still lots of differences between IE11 and the latest Firefix browser.
It is the short-cut to save time so that a million other developers, like yours truly, can spend hours searching for or inventing a solution.  It's the kind of lazy logic that makes the world just a little bit worse.
Thank you Microsoft-bozo, whoever you are, that made this LAME decision.


PS: Ah Microsoft receives the righteous consequence of their stupidity:
Google is not happy with IE11!

The browser we detected is unsupported and may result in unexpected behavior.
Please choose from our list of
supported browsers for the best experience.