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

后端 未结 1 1915
慢半拍i
慢半拍i 2020-12-01 04:35

I\'m playing around with the HTTP range header (specs).

From what I understand I can set byte ranges of files ala

0-199/2000
200-499/2000
500-799/20         


        
相关标签:
1条回答
  • 2020-12-01 05:31

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

    var xmlhttp=new XMLHttpRequest();
    xmlhttp.open("GET","data.dat",false);
    xmlhttp.setRequestHeader("Range", "bytes=100-200");
    xmlhttp.send();
    console.info(xmlhttp); //--> returns only the partial content
    // Tested on Win7 with chrome 46+
    
    0 讨论(0)
提交回复
热议问题