不同浏览器加载不同文件

相对环境ie8模拟ie11模拟 
条件ie7ie8ie7ie8ie9ie10ie11谷歌
<!--[if IE 6]> 
  <script>
  console.log('只有IE6版本可见');
 </script>
<![endif]  -->
xxxxxxxx
<!--[if lte IE 6]> 
  <script>
  console.log('IE6及其以下版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if gte IE 6]> 
   <script>
  console.log('IE6及其以上版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if IE 7]> 
 <script>
  console.log('只有IE7版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if lte IE 7]> 
  <script>
  console.log('IE7及其以下版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if gte IE 7]> 
  <script>
  console.log('IE7及其以上的版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if IE 8]> 
   <script>
  console.log('只有IE8版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if lte IE 8]> 
 <script>
  console.log('IE8及其以下的版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if gte IE 8]> 
 <script>
  console.log('IE8及其以上的版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if IE 9]> 
   <script>
  console.log('只有IE9版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if lte IE 9]> 
 <script>
  console.log('IE9及其以下的版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if gte IE 9]> 
 <script>
  console.log('IE9及其以上的版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if IE 10]> 
   <script>
  console.log('只有IE10版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if lte IE 10]> 
 <script>
  console.log('IE10及其以下的版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!--[if gte IE 10]> 
 <script>
  console.log('IE10及其以上的版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if IE 11]> 
   <script>
  console.log('只有IE11版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if lte IE 11]> 
 <script>
  console.log('IE11及其以下的版本可见');
 </script>
<![endif]--> 
xxvvvxxx
<!--[if gte IE 11]> 
 <script>
  console.log('IE11及其以上的版本可见');
 </script>
<![endif]--> 
xxxxxxxx
<!-- <![if !IE]> 
<script>
  console.log('除了IE以外的版本');
 </script>
<![endif]>  -->
xxxxxxxx
 <![if !IE]> 
<script>
  console.log('除了IE以外的版本');
 </script>
<![endif]> 
xxxxxvvv
<!--[if IE]> 
 <script>
   console.log('仅IE');
  </script>
 <![endif]-->
xxvvvxxx

有高手可以解释一下,为什么会是这个结果?

条件判断不起效!!一直认为好使,引入兼容文件后不断报bug,找好几天才发现条件判断失败,未成功引入兼容文件。

最后兼容ie是js判断浏览器及版本后,动态加载script标签!


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值