From dd16d56dab3beec0ca191442ef13f11c9ebc6d3b Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Tue, 17 Dec 2013 02:48:01 +0000 Subject: Fix support for IE11, while keeping older IE versions still working --- src/lib/binaryXHR.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/lib/binaryXHR.js b/src/lib/binaryXHR.js index b92d732..e4e7515 100644 --- a/src/lib/binaryXHR.js +++ b/src/lib/binaryXHR.js @@ -199,10 +199,17 @@ function FetchBinaryURL(url) { } request.send(null); - var response=request.responseBody; - if (response==undefined){ // responseBody is non standard, but the only way to make it work in IE - response=request.responseText; + var response=this.responseText; + try { + // for older IE versions, the value in responseText is not usable + if (IEBinary_getLength(this.responseBody)>0) { + // will get here only for older verson of IE + response=this.responseBody; + } + } catch (err) { + // not IE, do nothing } + var bf=new BinaryFile(response); return bf; } @@ -217,10 +224,17 @@ function FetchBinaryURL(url) { function FetchBinaryURLAsync(url, callback, callback_arg) { var callback_wrapper = function() { if(this.readyState == 4) { - var response=this.responseBody; - if (response==undefined){ // responseBody is non standard, but the only way to make it work in IE - response=this.responseText; + var response=this.responseText; + try { + // for older IE versions, the value in responseText is not usable + if (IEBinary_getLength(this.responseBody)>0) { + // will get here only for older verson of IE + response=this.responseBody; + } + } catch (err) { + // not IE, do nothing } + var bf=new BinaryFile(response); if (callback_arg!=null) { callback(bf,callback_arg); -- cgit v1.2.3