Detecting Internet Explorer 9 acting as Internet Explorer 7
As a web developer, I’m often forced to support for outdated browsers like Internet Explorer 7. This requirement forces my hand to add wonky code to code that was otherwise working fine everywhere else. To help test my sites in multiple versions of Internet Explorer, I use Internet Explorer 9 on Windows 7 and use the Developer Tools to change the rendering mode of the page between IE 7, 8, and 9. It’s important to note that this is not an exact representation of what a user with Internet Explorer 7 would see on the page, but it is accurate enough for me.
One thing I found pretty early on is that while Internet Explorer 9 is rendering a page as IE 7, it’s user agent string still identifies itself as Internet Explorer 9 meaning that browser detection in JavaScript is likely to return the wrong results. So in addition to testing the user agent string for MSIE 7 (which would work on an actual version of IE7), I also test the value of document.documentMode. This value represents the mode the page is being rendered in (returns 7 for IE7).
Here’s Microsoft’s official tech docs about this property:
http://msdn.microsoft.com/en-us/library/cc196988(v=vs.85).aspx
Lifestream
-
Today, I'm going on an adventure.
-
JSON is the best.
-
I can't even count the number of open source projects I find on Google Code that only contain a link saying they've moved to @GitHub.
-
Has anyone else's Twitter spam increased significantly over the last month?
-
Giving a lot of thought to what I get enthused over lately: http://t.co/AqWLzIB1 (via @JohnPiper)
-
Recent Comments
Archives
Categories




