@@ -180,19 +180,10 @@ jQuery.extend({
180
180
password: null,
181
181
traditional: false,
182
182
*/
183
- // Create the request object; Microsoft failed to properly
184
- // implement the XMLHttpRequest in IE7 (can't request local files),
185
- // so we use the ActiveXObject when it is available
186
183
// This function can be overriden by calling jQuery.ajaxSetup
187
- xhr : window . XMLHttpRequest && ( window . location . protocol !== "file:" || ! window . ActiveXObject ) ?
188
- function ( ) {
189
- return new window . XMLHttpRequest ( ) ;
190
- } :
191
- function ( ) {
192
- try {
193
- return new window . ActiveXObject ( "Microsoft.XMLHTTP" ) ;
194
- } catch ( e ) { }
195
- } ,
184
+ xhr : function ( ) {
185
+ return new window . XMLHttpRequest ( ) ;
186
+ } ,
196
187
accepts : {
197
188
xml : "application/xml, text/xml" ,
198
189
html : "text/html" ,
@@ -695,6 +686,27 @@ jQuery.extend( jQuery.ajax, {
695
686
696
687
} ) ;
697
688
689
+ /*
690
+ * Create the request object; Microsoft failed to properly
691
+ * implement the XMLHttpRequest in IE7 (can't request local files),
692
+ * so we use the ActiveXObject when it is available
693
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
694
+ * we need a fallback.
695
+ */
696
+ if ( window . ActiveXObject ) {
697
+ jQuery . ajaxSettings . xhr = function ( ) {
698
+ if ( window . location . protocol !== "file:" ) {
699
+ try {
700
+ return new window . XMLHttpRequest ( ) ;
701
+ } catch ( e ) { }
702
+ }
703
+
704
+ try {
705
+ return new window . ActiveXObject ( "Microsoft.XMLHTTP" ) ;
706
+ } catch ( e ) { }
707
+ } ;
708
+ }
709
+
698
710
// Does this browser support XHR requests?
699
711
jQuery . support . ajax = ! ! jQuery . ajaxSettings . xhr ( ) ;
700
712
0 commit comments