我在理解Jquery代码时遇到了问题。我正在尝试启用应用程序(Backbone)在IE 7,8& 9.问题在于Jquery(版本1.10.2)Ajax准备:
function createStandardXHR() {
debugger;
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
更确切地说:
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
在IE 7,8& 9给出False并阻止我的申请继续进行。我可以自己检测特定的IE版本,但Jquery应该自动执行此操作...或者我失败了什么?