Jul*_*ian 1 javascript greasemonkey range http-headers
我尝试使用Range-header在Greasemonkey脚本中发送请求.请求的网站有点长,我知道我实际需要哪些部分,所以我想,而不是要求整个网站下载我可以请求必要的500字节来加快速度.
但是,Range: bytes=0-500总是给我完整的网站.我也试过了Content-Range: bytes=0-500,但是不起作用,Content-Length:500由于安全问题,不允许再设置它.
那么,有谁知道,为什么会这样?我正在使用Greasemonkey脚本:
GM_xmlhttpRequest({
method: 'GET',
url: "http://colonel-strawberry.deviantart.com/",
headers: {"Range": "bytes=0-500"},
onload: function (responseDetails) {
console.log(responseDetails);
},
onerror: function(responseDetails) {
console.log("err:"+responseDetails);
}
});
Run Code Online (Sandbox Code Playgroud)
使用response-header:
Date: Mon, 05 Nov 2012 17:11:42 GMT
Content-Encoding: gzip
Transfer-Encoding: chunked
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR CURa OUR STP"
Connection: Keep-Alive
Server: Apache
Vary: Accept-Encoding
Content-Type: text/html
Cache-Control: private
Keep-Alive: timeout=45
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
953 次 |
| 最近记录: |