I'm trying to get the progress of an ajax request via the following code:
var xhr = new XMLHttpRequest();
xhr.addEventListener('progress', function(event) {
console.log(event.loaded / event.total);
},
false);
xhr.addEventListener('load', function() {
console.log('load');
},
false);
xhr.open('get', 'test.php', true);
xhr.send();
The problem is, the progress event only fires once, right before the load event (that is, in Webkit, it doesn't seem to work under Gecko).
Am I doing something wrong or is it just not supported properly?