Conditional comment for #39;Except IE8#39;?(“IE8 除外的条件注释?)
问题描述
我正在使用 <!--[if IE 8]><![endif]-->
来定位 IE8,但是我想加载一些 JS除了 IE8 之外的所有浏览器,我应该使用什么条件注释?
I'm using <!--[if IE 8]><![endif]-->
for targeting IE8, but there's some JS that I want to load for all browsers EXCEPT IE8, what conditional comment should I use?
我想知道这是否可行:<!--[if lte IE 8]><![endif]-->
谢谢
推荐答案
我能想到一个窍门.在 IE 条件标记内设置一个变量,如果没有设置该变量,则包含您的 JS 代码.
I can think of a trick. Set a variable inside the IE conditional tag and include your JS code if that variable isn't set.
<script>
var ie8 = false;
</script>
<!--[if IE 8]>
<script>
ie8 = true;
</script>
<![endif]-->
<script>
if (ie8 == false) {
// any code here will not be executed by IE 8
alert("Not IE 8!");
}
</script>
这篇关于“IE8 除外"的条件注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“IE8 除外"的条件注释?


- 失败的 Canvas 360 jquery 插件 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 400或500级别的HTTP响应 2022-01-01