使用以下代码防止任何版本的IE在IE8之前加载几个脚本。
问题是脚本仍然加载在IE7中,而条件标记(在文档的标题中)实际上正在呈现并显示在页面上!!
<!--[if gte IE 8]-->
<script src="<?php bloginfo('template_url'); ?>/scripts/voter.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/hover.js" type="text/javascript"></script>
<!--[endif]-->
发布于 2010-10-21 13:43:08
问题是你会立即关闭条件注释(即在末尾加上-->
),这是无效的语法。
您应该让<!--[if gte IE 8]>
后跟<![endif]-->
来关闭,而不是<!--[if gte IE 8]-->
。
Microsoft's page about Conditional Comments有很多关于如何使用它们的例子。
https://stackoverflow.com/questions/3987925
复制相似问题