Jquery 未正确设置IE 7、8和;9
我在理解Jquery代码时遇到问题。我正在尝试使应用程序(主干)在IE7、8和9中工作。问题在于Jquery(1.10.2版)的Ajax准备工作:Jquery 未正确设置IE 7、8和;9,jquery,ajax,internet-explorer,Jquery,Ajax,Internet Explorer,我在理解Jquery代码时遇到问题。我正在尝试使应用程序(主干)在IE7、8和9中工作。问题在于Jquery(1.10.2版)的Ajax准备工作: function createStandardXHR() { debugger; try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { retu
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应该自动检测。。。或者我失败了?IE 7、8和9返回false,因为这些浏览器不支持CORS。你的问题到底是什么?IE7甚至没有在任何受支持的操作系统上运行。Jason,你到底为什么要编写新的代码来针对一个根本没有人应该运行的浏览器呢。我的问题是我是否应该修改jquery,让它认为这些浏览器支持CORS。Ajax并不是为这些浏览器而单独形成的。如果我把它设置为true,那么它就工作了。我想知道还有什么我能做的吗?乔尔你说得对,我不会追求IE6。。。没有理由这么做。