Я использую js fetch API для получения данных из JSON. Он работает нормально (даже в IE 11), за исключением Edge 17, я получаю 302, заголовок ответа:
Мой локальный веб-сайт находится на Mac, я использую BrowserSync, чтобы сделать его доступным через 192.168.100.X: 3000 Затем я обновил файл hosts на моем ПК следующим образом:
192.168.100.X http://local.mysite.com
Вот мой вызов:
fetch('/fr/fil-actualites-json', { mode: 'cors' })
.then(
function(response) {
console.info('code :' +response.status);
if (response.status !== 200) {
console.info('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
// do some stuff
});
}
)
.catch(function(err) {
console.info('Fetch Error :-S', err);
});
Спасибо за вашу помощь;)

Safari выдавал эту ошибку:
unhandled promise rejection syntaxerror the string did not match the expected pattern
Я нашел ответ:
The default value for credentials is "same-origin".
The default for credentials wasn't always the same, though. The following versions of browsers implemented an older version of the fetch specification where the default was "omit":
Firefox 39-60 Chrome 42-67 Safari 10.1-11.1.2 If you target these browsers, it's advisable to always specify credentials: 'same-origin' explicitly with all fetch requests instead of relying on the default:
fetch('/users', {
credentials: 'same-origin'
})