简体   繁体   English

Respond.js无法跨域工作

[英]Respond.js not working cross domain

I'm having difficulty getting Respond's CDN/X-Domain Setup working. 我很难让Respond的CDN / X-Domain设置正常工作。

I started off serving all assets from the CDN: 我开始提供CDN的所有资产:

<link rel="stylesheet" href="http://cdn.example.com/css/main.css?2013012401">
<script src="http://cdn.example.com/js/modernizr-2.6.2.min.js?2013012401"></script>
<script src="http://cdn.example.com/js/respond.min.js?2013012401"></script>

In theory this should work, since all assets are being served from the same domain. 理论上这应该有效,因为所有资产都来自同一个域。 However IE8 didn't receive Media Query support like it should. 但IE8并没有像它应该那样接收Media Query支持。 So I investigated Respond's CDN/X-Domain Setup and amended my <head> section to this: 所以我调查了Respond的CDN / X-Domain设置并修改了我的<head>部分:

<link rel="stylesheet" href="http://cdn.example.com/css/main.css?2013012401">
<script src="http://cdn.example.com/js/modernizr-2.6.2.min.js?2013012401"></script>
<script src="http://cdn.example.com/js/respond.min.js?2013012401"></script>
<link href="http://cdn.example.com/respond-proxy.html?2013012401" id="respond-proxy" rel="respond-proxy">
<link href="http://cdn.example.com/img/respond.proxy.gif?2013012401" id="respond-redirect" rel="respond-redirect">
<script src="http://cdn.example.com/js/respond.proxy.js?2013012401"></script>

When that also failed, I amended my <head> section to this: 当这也失败了,我修改了我的<head>部分:

<link rel="stylesheet" href="http://cdn.example.com/css/main.css?2013012401">
<script src="http://cdn.example.com/js/modernizr-2.6.2.min.js?2013012401"></script>
<script src="http://cdn.example.com/js/respond.min.js?2013012401"></script>
<link href="http://cdn.example.com/respond-proxy.html?2013012401" id="respond-proxy" rel="respond-proxy">
<link href="/img/respond.proxy.gif" id="respond-redirect" rel="respond-redirect">
<script src="/js/respond.proxy.js"></script>

I'm not sure what else I can try really to get this to work. 我不确定我还能尝试什么才能让它发挥作用。 It works fine in a local Dev environment that's not using the CDN, but in the Live environment this Respond.js CDN/X-Domain Setup is not working. 它在没有使用CDN的本地Dev环境中工作正常,但在Live环境中,此Respond.js CDN / X-Domain安装程序无法正常工作。 Could it possibly be related to the cache-buster query string added to the CDN assets? 它可能与添加到CDN资产的cache-buster查询字符串有关吗? Why is my original example not working when all assets are being served from the same domain? 当所有资产都来自同一个域时,为什么我的原始示例无法正常工作?

Edit: Here's the error that's thrown in IE8 编辑: 这是IE8中抛出的错误

This issue was caused by the respond-proxy.html file reference containing a query string ( respond-proxy.html?2013012401 ). 此问题是由包含查询字符串的respond-proxy.html文件引用引起的( respond-proxy.html?2013012401 )。 Removing the query string from this file causes the above implementation to work. 从此文件中删除查询字符串会导致上述实现工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM