Skip to content

Commit 5638bf5

Browse files
committed
Update httpBackend, check window.XMLHttpRequest
As per this issue: angular#5677
1 parent ac4e9a7 commit 5638bf5

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/ng/httpBackend.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
'use strict';
22

33
function createXhr(method) {
4-
// IE8 doesn't support PATCH method, but the ActiveX object does
5-
/* global ActiveXObject */
6-
return ((msie <= 8 && lowercase(method) === 'patch') || isUndefined(window.XMLHttpRequest))
7-
? new ActiveXObject('Microsoft.XMLHTTP')
8-
: new window.XMLHttpRequest();
9-
}
4+
//if IE and the method is not RFC2616 compliant, or if XMLHttpRequest
5+
//is not available, try getting an ActiveXObject. Otherwise, use XMLHttpRequest
6+
//if it is available
7+
if ((window.ActiveXObject && !method.match(/^(get|post|head|put|delete|options)$/i))
8+
|| !window.XMLHttpRequest) {
9+
10+
return new ActiveXObject("Microsoft.XMLHTTP");
11+
} else if (window.XMLHttpRequest) {
12+
return new window.XMLHttpRequest();
13+
}
1014

15+
throw $httpMinErr('noxhr', 'This browser does not support XMLHttpRequest.');
16+
}
1117

1218
/**
1319
* @ngdoc object

0 commit comments

Comments
 (0)