XMLHttpRequest 206 Partial Content

This range-request works fine for me: http://jsfiddle.net/QFdU4/

var xhr = new XMLHttpRequest;

xhr.onreadystatechange = function () {
  if (xhr.readyState != 4) {
    return;
  }
  alert(xhr.status);
};

xhr.open('GET', 'http://fiddle.jshell.net/img/logo.png', true);
xhr.setRequestHeader('Range', 'bytes=100-200'); // the bytes (incl.) you request
xhr.send(null);

You have to make sure that the server allows range requests, though. You can test it with curl:

$ curl -v -r 100-200 http://example.com/movie.mkv > /dev/null

Leave a Comment