3

我正在尝试让媒体查询在 IE 8 中运行,并且Respond.js在开发中运行良好。但是,当我将它部署到我的生产环境时,Respond.js 无法正常工作,这很神奇。我已按照 GitHub 上的说明使用 CDN 进行设置(我们使用 S3 和 Cloudfront),并且我已确保所有 javascript 和 respond-proxy.html 文件都可在我指定的 URL 中使用。

我目前的理论是,这是 Django 在某处停止了 Respond.js 的 AJAX,特别是,我的 Django 日志中的这一行证明了这一点:

WARNING Wed, 03 Oct 2012 15:22:13 +0000 base xxx xxxxxxx Not Found: /https://dxxxxxxxxxxxx.cloudfront.net/j/r/respond-proxy.html

它似乎正在尝试/https://d...在本地服务器上查找。该行在每个页面请求中出现多次。

这是代码:

<link rel="stylesheet" type="text/css" media="screen" href="https://dxxxxxxxxxx.cloudfront.net/static/css/style.css" />
<script type="text/javascript" src="/static/js/respond.src.js"></script>
<link href="https://dxxxxxxxxxx.cloudfront.net/static/js/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<link href="/static/js/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<script type="text/javascript" src="/static/js/respond.proxy.js"></script>

请注意,我的 CSS 是使用 django-compressor 压缩的,我的其他 JS 也是如此。上面的代码在 {% compress %} 块之外。

4

1 回答 1

1

原来我需要破解 response.proxy.js 才能让它工作。我在 checkBaseUrl() 中注释掉了第 74 行:

//          href = bref + href;

请注意,这可能是由我的页面上运行的其他 JS 引起的,并且可能不是(可能不是?)respond.proxy.js 中的错误。

于 2012-10-04T22:53:32.533 回答