If XHR2 is supported with file-upload capabilites, my application needs to do different preparation. What is a safe way to check if these capabilities are supported. Is it sufficient, for example, to just check an XMLHttpRequest
(or MS equivalents) for the upload
property? like...
var xhr = new XMLHttpRequest();
if (typeof xhr.upload !== "undefined") {
do nice stuff
}
else {
do oldschool stuff
}
Or is this not safe?
if (new XMLHttpRequest().upload) {
// welcome home!
} else {
// not supported
}