diff --git a/lib/transports/polling-xhr.js b/lib/transports/polling-xhr.js index 297bac59e..6044266a9 100755 --- a/lib/transports/polling-xhr.js +++ b/lib/transports/polling-xhr.js @@ -239,13 +239,12 @@ Request.prototype.create = function () { } else { xhr.onreadystatechange = function () { if (xhr.readyState === 2) { - var contentType; try { - contentType = xhr.getResponseHeader('Content-Type'); + var contentType = xhr.getResponseHeader('Content-Type'); + if (contentType === 'application/octet-stream') { + xhr.responseType = 'arraybuffer'; + } } catch (e) {} - if (contentType === 'application/octet-stream') { - xhr.responseType = 'arraybuffer'; - } } if (4 !== xhr.readyState) return; if (200 === xhr.status || 1223 === xhr.status) {