xhr.ondatastream not firing
I'm having trouble getting my XHR requests to fire the ondatastream event, I want to have some sort of progress indicator.
My server is sending the Content-Length header.
xhr.open('GET', 'http://example.org/file.zip');
xhr.onload = function(e) {
log('done');
};
xhr.onerror = function(e) {
log('error');
};
xhr.ondatastream = function(e) {
// this function never fires?
log(e.progress);
};
xhr.send();
2 Answers
-
Accepted Answer
Try this
xhr.ondatastream = function(e) { // this function never fires? log(e.progress); }; xhr.open('GET', 'http://example.org/file.zip'); xhr.onload = function(e) { log('done'); }; xhr.onerror = function(e) { log('error'); }; xhr.send();
-
I am also getting the same error. Implemented the above process but still ondatastream get strikes one with value '1'.
Please suggest if you have any other alternatives.