【发布时间】:2014-05-16 02:39:41
【问题描述】:
我正在使用自定义引导 wordpress 主题。
我的头是根据 Bootstrap 建议创建的
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
我可能误解了 IE 条件标记的意义,但我希望 IE hack 代码只能在 IE 中加载,但是所有这些脚本都存在于 Chrome 中。
我是否滥用了这个标签?是否有另一种推荐的方法来确保这些脚本只为比版本 9 更轻的 IE 浏览器加载?
我更喜欢让我的页面尽可能简洁,所以我不想为了安抚仍在使用 ie8 及以下版本的愚蠢的少数人而加载不必要的代码。
【问题讨论】:
标签: wordpress twitter-bootstrap internet-explorer conditional