diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 29f390e0402b..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') - ? 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