【问题标题】:jquery import not working on IE, Firefox, Safarijquery 导入在 IE、Firefox、Safari 上不起作用
【发布时间】:2016-01-05 12:09:04
【问题描述】:

我已经成功地在我的所有页面上导入了相同的页眉和页脚,我总是使用 Chrome,然后当我试图打开我在 IE 和 Firefox 上工作的网站时,他们不显示我的页眉和页脚。

我错过了什么?

Firefox 显示此消息 click to view image

而 IE 没有显示。

这是我的导入代码

<link rel="import" id="allheader" href="header.html">

<script>

            var getImport  = document.querySelector('#allheader');
            var getContent = getImport.import.querySelector('#header');
            document.body.appendChild(document.importNode(getContent, true));
        </script>

我需要做什么?谢谢

【问题讨论】:

  • 你能给我找一些关于你在上面使用的 .import 函数的文档吗?
  • @ArcaneCraeda 嗨,我编辑了我的帖子,这是你需要的吗?
  • 不完全是,我想知道在getImport.import.querySelector('#header'); 中使用的import 函数是否有在线文档

标签: jquery html internet-explorer firefox import


【解决方案1】:

Chrome 和 Opera 以外的浏览器目前不支持 HTML 导入。查看 this link 以获取完整的浏览器支持列表。 Firefox will not ship with imports,他们暂时不打算这样做。

我建议您使用 polyfill,例如 Google 的 webcomponents.js。在HTML Imports 上查看页面。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-12
    相关资源
    最近更新 更多