Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari xhr (AJAX) requests w/ cross-domain redirect fails

How to reproduce the issue

  1. Make an AJAX request to a server using Safari
  2. Have the server response w/ 302 to a different domain

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

  1. Use a different browser, it works.
  2. Have the server redirect to same domain, it works.

.

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();
}

enter image description here enter image description here

like image 919
hrdwdmrbl Avatar asked Oct 09 '15 17:10

hrdwdmrbl


1 Answers

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

like image 81
Knu Avatar answered Nov 14 '22 23:11

Knu