【发布时间】:2014-10-08 06:09:10
【问题描述】:
我正在尝试使用可在 http://polymer-project.org 上托管的 Polymer 组件版本来试验 Polymer,直到出现真正的 CDN(根据常见问题解答)。不幸的是,导入组件总是失败并出现 CORS 错误。
现在我的代码看起来像这样,并不复杂:
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<script src="//polymer-project.org/components/platform/platform.js"></script>
<link rel="import" href="//polymer-project.org/components/font-roboto/roboto.html"/>
</head>
<body>
</body>
</html>
但我在加载 roboto.html 时从 Chrome 中收到此错误:
在源“http://polymer-project.org”的重定向已被跨域资源共享策略阻止加载:请求的资源上不存在“Access-Control-Allow-Origin”标头。
这应该可行,对吧? roboto.html 已启用 CORS,并且我已验证它正在发送 Access-Control-Allow-Origin: * 标头,那么为什么这不起作用?
【问题讨论】: