我正在使用js fetch API从JSON检索数据。它工作正常(即使在IE 11中也是如此),除了在Edge 17中我得到302之外,响应标头是:
我的本地网站在Mac上,我正在使用BrowserSync通过192.168.100.X:3000进行访问,然后更新了PC主机文件,如下所示:
192.168.100.X http://local.mysite.com
Run Code Online (Sandbox Code Playgroud)
这是我的访存电话:
fetch('/fr/fil-actualites-json', { mode: 'cors' })
.then(
function(response) {
console.log('code :' +response.status);
if (response.status !== 200) {
console.log('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.log('Fetch Error :-S', err);
});
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助;)