if (!jQuery.support.cors && window.XDomainRequest) {
var httpRegEx = /^https?:\/\//i;
var getOrPostRegEx = /^get|post$/i;
var sameSchemeRegEx = new RegExp('^'+location.protocol, 'i');
var xmlRegEx = /\/xml/i;
// ajaxTransport exists in jQuery 1.5+
jQuery.ajaxTransport('text html xml json', function(options, userOptions, jqXHR){
// XDomainRequests must be: asynchronous, GET or POST methods, HTTP or HTTPS protocol, and same scheme as calling page
if (options.crossDomain && options.async && getOrPostRegEx.test(options.type) && httpRegEx.test(userOptions.url) && sameSchemeRegEx.test(userOptions.url)) {
var xdr = null;
var userType = (userOptions.dataType||'').toLowerCase();
return {
ie-9 以下ajax无法跨域的问题。只要add:jQuery.support.cors=true;即可
最新推荐文章于 2023-12-07 23:08:20 发布
博客介绍了在IE9及以下版本中,使用jQuery进行AJAX请求时遇到的跨域问题。通过设置jQuery.support.cors为true,可以解决这个问题。
摘要由CSDN通过智能技术生成