Fetch() for http works on Windows but not on MacOS. Sample code.
This works on Windows but not on MacOS
fetch('http://gde.cz').then(function (response) {
return response.text();
}).then(function (html) {
console.log(html);
}).catch(function (err) {
console.warn('Something went wrong.', err);
});
This works on both
fetch('https://gde.cz').then(function (response) {
return response.text();
}).then(function (html) {
console.log(html);
}).catch(function (err) {
console.warn('Something went wrong.', err);
});
Why is that? I want to use it only for localhost. But with this, I would need to do something very complicated about certificates.