2015-10-09 10 views
7

Come riprodurre il problemaSafari XHR (AJAX) richiede w/cross-domain di reindirizzamento non riesce

  1. Fare una richiesta AJAX a un server utilizzando Safari
  2. Avere la risposta del server w/302 a un dominio diverso

Se una di queste condizioni è non incontrati, funziona.

  1. Utilizzare un altro browser, funziona.
  2. Se il server reindirizza allo stesso dominio, funziona.

.

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

+0

Questo è un problema noto con Safari. Sembra che in realtà sia in fase di elaborazione a partire da https://bugs.webkit.org/show_bug.cgi?id=112471. – itayad

+0

Tuttavia, assicurati che il tuo server supporti CORS –

risposta

1

Questo bug è stato fissato.
Safari 10.1 (WebKit 603.1.30) era la prima versione non interessata.

+0

Grazie! Purtroppo ho chiesto tanto tempo fa che non ho più il codice in giro per testare. Se qualcuno può confermare che è corretto, contrassegnerò la tua risposta come corretta – hrdwdmrbl

Problemi correlati