【发布时间】:2013-08-09 00:35:18
【问题描述】:
我只想加载 html5shiv.js 文件如果网络浏览器低于 IE 9。
我的代码是
<doctype html>
<html>
<head>
<!--[if lt IE 9]
<script type="text/javascript" src="html5shiv.js"></script>
-->
</head>
<!-- ... -->
</html>
当我测试这是否有效时(我通过在开发者工具中将浏览器模式选项更改为低于 IE 9 的版本来做到这一点 - 我不清楚这是否有效。
这对你有用吗 - 或者代码至少正确?
【问题讨论】:
-
嗯,你的语法不对,quirksmode.org/css/condcom.html
-
这是我从中获取条件代码的同一页面。
-
看起来您复制/粘贴错误。您的文档类型也不正确。
-
抱歉,我在格式化代码时不小心删除了 位。
标签: javascript html conditional-comments html5shiv