我在我的网站上使用jQuery jPlayer圆形皮肤播放远程网址,下面的代码工作得很好,除非网址是来自特定的网址,(称之为http://prob.lem),我总是得到{ {1}},虽然使用浏览器或使用wget来下载mp3没有问题。我对jQuery的了解有限,我最好猜测jQuery jPlayer发送请求的方式与通常的浏览器或wget不同(错误?),另一个检测到它并拒绝提供内容。
问题是:假设我猜对了,我的网站是否有工作可以让我的jPlayer仍然获取内容?如果我的猜测错了,我应该在哪里看? 谢谢,
"NetworkError: 403 Forbidden - http://prob.lem/upload_music/7154816.mp3"
另外,以下是来自firebug的请求信息:
<script type="text/javascript">
//<![CDATA[
var $j = jQuery.noConflict();
$j(document).ready(function(){
var myCirclePlayer = new CirclePlayer("#jquery_jplayer_1",
{
mp3: "http://prob.lem/upload_music/7154816.mp3"
}, {
cssSelectorAncestor: "#cp_container_1",
supplied: "mp3",
swfPath: "wp-content/plugins/magic-media-box/js/Jplayer.swf",
wmode: "window",
keyEnabled: true,
});
});
//]]>
</script>
如果我直接在firefox中打开链接,请求信息看起来确实不同:
Response Headers
HTTP/1.1 403 Forbidden
Date: Tue, 23 Jul 2013 20:24:25 GMT
Server: Apache
Content-Length: 291
Connection: close
Content-Type: text/html; charset=iso-8859-1
Request Headers
GET /upload_music/7154816.mp3 HTTP/1.1
Host: prob.lem
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Range: bytes=0-
Referer: http://my.site/index.php/category/ktv/
Connection: keep-alive
我可以看到,在请求标头中,Response Headers
HTTP/1.1 200 OK
Date: Tue, 23 Jul 2013 20:34:12 GMT
Server: Apache
Last-Modified: Sun, 21 Jul 2013 23:05:06 GMT
Etag: "1b2803e-b5ffef-4e20d97386aba"
Accept-Ranges: bytes
Content-Length: 11927535
Connection: close
Content-Type: audio/mpeg
Request Headers
GET /upload_music/7154816.mp3 HTTP/1.1
Host: prob.lem
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
和Accept
字符串不同,因此响应不同。我可以让jQuery jPlayer发送与Firefox浏览器相同的Headers吗?
谢谢,