Safari xhr(AJAX)请求w /跨域重定向失败 [英] Safari xhr (AJAX) requests w/ cross-domain redirect fails

查看:293
本文介绍了Safari xhr(AJAX)请求w /跨域重定向失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重现问题


  1. 使用Safari向服务器发出AJAX请求

  2. 让服务器响应w / 302到另一个域

如果其中任何一个条件 遇到了,它有效。

If either of those conditions is not met, it works.


  1. 使用其他浏览器,它可以正常工作。

  2. 让服务器重定向到同一个域,它可以工作。

Load: function (in_url, in_cb, in_responseType) {
  var xhr = new XMLHttpRequest();
  xhr.open('GET', in_url, true);
  xhr.onload = function () {
    if (xhr.status === 200) {
      in_cb(null, xhr.response);
    } else {
      in_cb(new Error('[Loader] Could not fetch from: '+in_url+', status: '+xhr.status));
    }
  };
  xhr.onerror = function (error) {
    in_cb(error);
  };

  xhr.send();
}


推荐答案

bug 已修复。

Safari 10.1(WebKit 603.1.30)原第一个版本没有受到影响。

This bug was fixed.
Safari 10.1 (WebKit 603.1.30) was the first version not affected.

这篇关于Safari xhr(AJAX)请求w /跨域重定向失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆