针对IE = 9兼容模式的条件注释 [英] Conditional comment for IE=9 compatibility mode
本文介绍了针对IE = 9兼容模式的条件注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下条件注释来通知用户它们正在运行不受支持的浏览器版本。
I'm using the following conditional comment to notify users thet they are running a non-supported browser version.
<!--[if lt IE 8]>
...
<![endif]-->
我注意到这个评论正在IE9兼容模式中触发 - 那么我不注意什么。
I noticed that this comment is being triggered on IE9 Compatibility mode as-well what was not my attention.
有没有办法让IE9兼容模式成为例外,或者将其与IE7模式区别开来,以便我可以为它们定制消息?
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?
推荐答案
检查兼容模式的一个简单方法是:
One easy way to check compatibility mode is:
try{ JSON } catch (e){ alert("Compatibility Mode Detected") }
这适用,因为在兼容模式下JSON对象不可用。
This works because the JSON object is unavailable while in compatibility mode.
这篇关于针对IE = 9兼容模式的条件注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文