Respond.js不工作跨域 [英] Respond.js not working cross domain

查看:224
本文介绍了Respond.js不工作跨域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获取响应的CDN / X域设置工作

I started off serving all assets from the CDN:

< link rel =stylesheethref =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 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>

理论上这应该可以工作,因为所有资产都是从同一个域提供的。然而IE8没有收到媒体查询支持喜欢它应该。所以我调查了Respond的CDN / X-Domain设置,并将我的< head> 部分修改为:

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. So I investigated Respond's CDN/X-Domain Setup and amended my <head> section to this:

<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>

当这也失败时,我修改了我的< head> 此部分:

When that also failed, I amended my <head> section to this:

<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>

我不知道还有什么可以尝试让这个工作。它在不使用CDN的本地Dev环境中正常工作,但在Live环境中,此Respond.js CDN / X-Domain安装程序不工作。是否可能与添加到CDN资产的缓存无效化查询字符串相关?

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. Could it possibly be related to the cache-buster query string added to the CDN assets? Why is my original example not working when all assets are being served from the same domain?

编辑这是在IE8中抛出的错误

推荐答案

此问题是由包含查询字符串的 respond-proxy.html 文件引用引起的( respond-proxy.html?2013012401 )。从此文件中删除查询字符串会导致上述实现工作。

This issue was caused by the respond-proxy.html file reference containing a query string (respond-proxy.html?2013012401). Removing the query string from this file causes the above implementation to work.

这篇关于Respond.js不工作跨域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆