问题
I'm using the following conditional comment to notify users thet they are running a non-supported browser version.
<!--[if lt IE 8]>
...
<![endif]-->
I noticed that this comment is being triggered on IE9 Compatibility mode as-well what was not my attention.
Is there a way to make IE9 Compatibility mode an exception or to distinguish it and IE7 mode from regular IE7 so that I can customize the message for them?
回答1:
One easy way to check compatibility mode is:
try{ JSON } catch (e){ alert("Compatibility Mode Detected") }
This works because the JSON object is unavailable while in compatibility mode.
来源:https://stackoverflow.com/questions/10579753/conditional-comment-for-ie-9-compatibility-mode