mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-19 06:36:15 +08:00
refactor($http) Simplify code by removing workarounds for older versions of Internet Explorer
This removes a workaround for IE 8 and and error handling for IE6. Closes #9300
This commit is contained in:
committed by
Igor Minar
parent
d9457aa288
commit
f52203ce71
@@ -1,10 +0,0 @@
|
||||
@ngdoc error
|
||||
@name $httpBackend:noxhr
|
||||
@fullName Unsupported XHR
|
||||
@description
|
||||
|
||||
This error occurs in browsers that do not support XmlHttpRequest. AngularJS
|
||||
supports Safari, Chrome, Firefox, Opera, IE8 and higher, and mobile browsers
|
||||
(Android, Chrome Mobile, iOS Safari). To avoid this error, use an officially
|
||||
supported browser.
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function createXhr(method) {
|
||||
//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 (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
|
||||
!window.XMLHttpRequest)) {
|
||||
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
||||
} else if (window.XMLHttpRequest) {
|
||||
return new window.XMLHttpRequest();
|
||||
}
|
||||
|
||||
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest.");
|
||||
function createXhr() {
|
||||
return new window.XMLHttpRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +49,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
|
||||
});
|
||||
} else {
|
||||
|
||||
var xhr = createXhr(method);
|
||||
var xhr = createXhr();
|
||||
|
||||
xhr.open(method, url, true);
|
||||
forEach(headers, function(value, key) {
|
||||
|
||||
Reference in New Issue
Block a user