javascript - How to detect a browser that will not support XHR2 Upload progress -


few android browsers including samsung default browsers on older devices not support

xhr.upload.onprogress 

event. cannot show realtime upload progress on browsers.

how can detect browsers? can change setup show progress.

simply :

var xhr = new xmlhttprequest(); if ( xhr && ('upload' in xhr) && ('onprogress' in xhr.upload) ) // attach event... 

so if want function :

function supportajaxuploadprogressevents() {   var xhr = new xmlhttprequest();   return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload)); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -