简体   繁体   English

IE = 9兼容模式的条件注释

[英]Conditional comment for IE=9 compatibility mode

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. 我注意到,此评论是在IE9兼容模式下触发的,但我没有注意。

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? 有没有办法使IE9兼容模式成为例外,或者将其与常规IE7和IE7模式区分开来,以便我可以为他们自定义消息?

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. 之所以可行,是因为在兼容模式下JSON对象不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM