Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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();
— asked November 29th 2010 by Peter
  • ondatastream
  • xhr
0 Comments

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();
    
    — answered November 29th 2010 by Chris Johnson
    permalink
    2 Comments
    • I'm just trying to book mark this since it bytes me over and over again.

      — commented July 31st 2014 by Glenn Bennett
    • 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.

      — commented September 19th 2014 by Raju Mahato
  • 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.

    — answered September 19th 2014 by Raju Mahato
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.