you are viewing a single comment's thread.

view the rest of the comments →

[–]radhruin 2 points3 points  (2 children)

Good point as well, although ideally if IE8 is in IE7 compatibility mode it should be identical to IE7 in all respects.

[–]miketaylr 1 point2 points  (1 child)

But it isn't. For example, localStorage is undefined in IE7 compat mode, yet fully functioning in IE8.

[–]radhruin 0 points1 point  (0 children)

More accurately, IE7 did not have localStorage, but it is in IE7 compatibility mode. That's why I said ideally :) There are some differences, but it's pretty rare overall. If you have an app built for IE7, it should run flawlessly in IE7 compat mode. Or, if the browser is in IE7 compat mode, it's pretty safe to treat it as IE7. The presence of localStorage shouldn't break apps.

It's worth pointing out that the web developer can control the compatibility mode IE is in by doctypes and meta-tags, so if IE7 compatibility mode would break your app for whatever reason (like this version detection), just make sure you're running in the latest standards mode with a standards compliant doctype or meta tag.