使用AJAX

时间:2015-08-22 22:46:48

标签: javascript ajax

这可能吗?我认为只要服务器支持resume(HTTP RANGE)就可以了。

1 个答案:

答案 0 :(得分:2)

使用XMLHttpRequest.prototype.setRequestHeader()设置RANGE请求标头:

//Our AJAX object:
var req = new XMLHttpRequest();
req.open([REQUEST METHOD], [REQUEST URI], true);
//Set the RANGE header here:
req.setRequestHeader("RANGE", "value-of-RANGE-header");
// [Here, set anything else you need before sending the request, like onstatechange]
//Now, send!
req.send();