最新进展:似乎我可以将firebase排除在可能的原因之外 . 因为我只用聚合物部署进行了测试,结果也很糟糕 .
我的项目使用Google Polymer并部署到firebase托管 . 它需要从firebase托管外部导入一些聚合物html文件 . 所以我将代码从以下“本地”更改为“外部” . 但是“外部”根本不起作用,“本地”表示我的本地计算机用于测试或firebase托管 . 你能指出我的代码有什么问题吗?
my-app.html具有以下链接之一 .
//"local: OK"
<link rel="import" href="some.html">
//"outside: not OK"
<link rel="import" href="https://outside.com/some.html">
my-app.html使用元素id =“some”作为
<template><some></some></template>
而“some.html”只包含一个带有以下简单模板的dom模块 . 让我省略其他部分,因为它们也是最小的 .
<template><h1>test</h1></template>
1 回答
为了使其工作,其他来源的资源必须启用CORS(跨源资源共享)作为this article状态 . HTML导入上的W3C draft也提到了它 .
link标记还有一个
crossorigin
属性,这可能对此有所帮助 . 例如 .<link rel="import" href="https://outside.com/some.html" crossorgin="anonymous">
.