javascript - 德鲁帕尔 8 : How do I add JS files inside libraries conditionally based on versions of IE7 and IE8?

标签 javascript internet-explorer drupal conditional-statements yaml

在 Drupal 8 中,如何在库中加载 JS 文件以仅在 IE8 上加载而不在 lte IE7 上加载?

我添加了以下内容,仅在 IE8 及更低版本上正确加载。

js:
    js/script.js: { browsers: { IE: 'lte IE 8', '!IE': false } }

但是,我怎样才能只在 IE8 上加载它呢?以及如何为 IE7 加载不同的 js 文件? 例如,这是否有效:

js:
    js/script.js: { browsers: { IE: 'IE 8', 'IE 7': false,  '!IE': false } }

最佳答案

<!--[if gte IE 8]>
<script src="ie8only.js"></script>
<![endif]-->

使用 IE 条件..

以上内容仅在 IE >= 8 上加载

参见:http://www.quirksmode.org/css/condcom.html

关于javascript - 德鲁帕尔 8 : How do I add JS files inside libraries conditionally based on versions of IE7 and IE8?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41576311/

相关文章:

javascript - 用其他字符替换字符串中的最后一个正斜杠

javascript - JavaScript中数字文字后的字符 'n'是什么意思?

javascript - NodeJS - 无法打开包含文件 : 'unistd.h' :

html - anchor 链接内的按钮在 Firefox 中有效,但在 Internet Explorer 中无效?

mysql - 如何在 Drupal 中执行此 SQL 查询?

Drupal 7 获取节点评论

drupal - 更新一个表中非空的字段

javascript - 如果匹配输入则返回 json 数组

css - 在 IE6/7 和 Firefox 上获得相同显示效果的最佳工具或技术是什么?

c# - 处理 IE 填写表单 C#