Few android browsers including Samsung default browsers on older devices will not support
xhr.upload.onprogress
Event. So we cannot show realtime upload progress on that browsers.
How can I detect those browsers? So I can change my setup to show progress.
Simply :
var xhr = new XMLHttpRequest();
if ( xhr && ('upload' in xhr) && ('onprogress' in xhr.upload) ) // attach event...
So if you want a function :
function supportAjaxUploadProgressEvents() {
var xhr = new XMLHttpRequest();
return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
}
hm. tested a very old Firefox's. 3.5.2.
first version that have (new XMLHttpRequest).upload
property.
Current version Chrome:
send(1); //progress 1 of 1 send(40000000_chars); // 1,2 or more progress events.
Firefox 3.5.2:
send(1); //no progress events. send(40000000_chars); // some progress events.
So if browser sending time is not big, there is no pregress
events on old browsers.
But load
event with .loaded == .total
is fired normally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With