I am listening on xhr.onprogress
request.onprogress = function(e){
return conf.progress ? conf.progress(e) : null;
};
where conf.progress
is
function(e){
var position = e.position || e.loaded;
var total = e.totalSize || e.total;
var percent = ((e.loaded/e.total)*100)+"";
console.log(percent);
console.log(position, total);
console.log(e);
}
percent
yields wrong value in console like 2.789069431137492e-11
and this is what console.log(e)
prints
XMLHttpRequestProgressEvent
bubbles: false
cancelBubble: false
cancelable: true
clipboardData: undefined
currentTarget: undefined
defaultPrevented: false
eventPhase: 2
lengthComputable: false
loaded: 4982035
position: 4982035
returnValue: true
srcElement: undefined
target: undefined
timeStamp: 1323097256269
total: 18446744073709552000
totalSize: 18446744073709552000
type: "progress"
__proto__: XMLHttpRequestProgressEvent
Why the e.totalSize: 18446744073709552000
is so big and even after the document is completely loaded e.loaded: 4982035
as totalSize
should be equal to loaded
when its complete