Conditional comment for IE=9 compatibility mode

十年热恋 提交于 2019-12-08 13:09:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!