Can I use the HTTP range header to load partial files “on purpose”?

You are right, the link which you posted in the comment would be probably the best approach. As your question sounded interesting i tried it out. You probably did it also, but here is an snippet (for other, that may come looking)

var xmlhttp = new XMLHttpRequest();"GET","data.dat",false);
xmlhttp.setRequestHeader("Range", "bytes=100-200");
xmlhttp.send();; //--> returns only the partial content
// Tested on Win7 with chrome 46+

Watch-out: the web-server has to support this Request Header Range, for it to work.

Leave a Comment