My website有反应。 blog section使用指向 Tumblr 的子域,但 Respond.js 的跨域版本不工作。我这样做:
<script src="http://www.stevechab.com/scripts/respond.min.js"></script>
<link href="http://www.stevechab.com/scripts/respond-proxy.html" id="respond-proxy" rel="respond-proxy">
<link href="http://www.stevechab.com/scripts/respond.proxy.gif" id="respond-redirect" rel="respond-redirect">
<script src="http://www.stevechab.com/scripts/respond.proxy.js"></script>
我假设问题是 respond.proxy.gif 和 respond.proxy.js 不在 blog.stevechab.com 上……但这不会破坏拥有跨域版本的 Respond 的目的。杰斯?我的假设是正确的,还是我遗漏了什么?有解决办法吗?
注意:我试过http://www.tumblr.com/themes/upload_static_file ... 没有骰子。
最佳答案
@史蒂夫查布,
respond.js 和 respond.proxy.js 不适合您的原因有两个。
您在原始域中有 respond-proxy.html 文件,而该文件应该是从您的子域 (blog.stevechab.com) 或任何其他外部域。
respond.js/respond.proxy.js 在链接到具有相对 url 的 css 文件时似乎存在错误。要修复它,请使用绝对 url。您的主站点为 css 样式表使用相对 url,而您的博客使用绝对 url。
- 注意:错误是由 respond.proxy.js ajax/xml 函数引起的
请在下面找到经过修订的工作标记,让 respond.js 和 respond.proxy.js 在您的网站上工作。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://www.stevechab.com/styles/styles.css">
<!--[if (lt IE 9) & (!IEMobile 7)]>
<link href="//blog.stevechab.com/scripts/respond-proxy.html" id="respond-proxy" rel="respond-proxy">
<link href="//www.stevechab.com/scripts/respond.proxy.gif" id="respond-redirect" rel="respond-redirect">
<![endif]-->
</head>
<body>
<!-- Your content goes here. -->
<!--[if (lt IE 9) & (!IEMobile 7)]>
<script src="//www.stevechab.com/scripts/respond.min.js"></script>
<script src="//www.stevechab.com/scripts/respond.proxy.js"></script>
<![endif]-->
</body>
</html>
- GitHub 上的 Respond.js
- 用于 Wordpress 的 Respond.js 插件
- Twitter Bootstrap 使用的 Respond.js
关于cross-domain - 使用 Tumblr 在子域上使用 Respond.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10749070/