From ac4e9a76fa2cdad8839db6eca9bdffa97192410d Mon Sep 17 00:00:00 2001 From: Jorg Date: Wed, 8 Jan 2014 11:23:33 +1000 Subject: [PATCH 1/2] Update httpBackend, check window.XMLHttpRequest As per this issue: https://github.com/angular/angular.js/issues/5677 window.XMLHttpRequest is not always available in IE8 despite it not running in quirks mode, in which case Angular should be using the ActiveXObject instead. Just checking the browser version is taking too many shortcuts. --- src/ng/httpBackend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 29f390e0402b..0194b4bd18d8 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -3,7 +3,7 @@ function createXhr(method) { // IE8 doesn't support PATCH method, but the ActiveX object does /* global ActiveXObject */ - return (msie <= 8 && lowercase(method) === 'patch') + return ((msie <= 8 && lowercase(method) === 'patch') || isUndefined(window.XMLHttpRequest)) ? new ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest(); } From 5638bf5465523fb92fe2a6d570963e7af9f45df3 Mon Sep 17 00:00:00 2001 From: Jorg Date: Thu, 23 Jan 2014 11:44:39 +1000 Subject: [PATCH 2/2] Update httpBackend, check window.XMLHttpRequest As per this issue: #5677 --- src/ng/httpBackend.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 0194b4bd18d8..19b1aebd5a0c 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -1,13 +1,19 @@ 'use strict'; function createXhr(method) { - // IE8 doesn't support PATCH method, but the ActiveX object does - /* global ActiveXObject */ - return ((msie <= 8 && lowercase(method) === 'patch') || isUndefined(window.XMLHttpRequest)) - ? new ActiveXObject('Microsoft.XMLHTTP') - : new window.XMLHttpRequest(); -} + //if IE and the method is not RFC2616 compliant, or if XMLHttpRequest + //is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest + //if it is available + if ((window.ActiveXObject && !method.match(/^(get|post|head|put|delete|options)$/i)) + || !window.XMLHttpRequest) { + + return new ActiveXObject("Microsoft.XMLHTTP"); + } else if (window.XMLHttpRequest) { + return new window.XMLHttpRequest(); + } + throw $httpMinErr('noxhr', 'This browser does not support XMLHttpRequest.'); +} /** * @ngdoc object