admin管理员组文章数量:1406453
I'm trying to ask an API with the fetch mand:
fetch('');
and chrome keep answer me :
net::ERR_FAILED
TypeError: Failed to fetch
I don't understand what's wrong with this simple code. Can anyone help me ?
Thanks
I'm trying to ask an API with the fetch mand:
fetch('http://fr1.api.radio-browser.info/json/tags');
and chrome keep answer me :
net::ERR_FAILED
TypeError: Failed to fetch
I don't understand what's wrong with this simple code. Can anyone help me ?
Thanks
Share edited Mar 20, 2022 at 8:14 VLAZ 29.2k9 gold badges63 silver badges84 bronze badges asked Mar 20, 2022 at 8:13 Khan From ChedumKhan From Chedum 311 gold badge1 silver badge6 bronze badges 1- 1 Check the network tab to see what the reason is. – VLAZ Commented Mar 20, 2022 at 8:14
1 Answer
Reset to default 3If you catch the error after calling fetch
, you should see a more descriptive error:
// HTTP
fetch('http://fr1.api.radio-browser.info/json/tags')
.catch(console.error);
Mixed Content: The page at 'https://fr1.api.radio-browser.info/json/tags' was loaded over HTTPS, but requested an insecure resource 'http://fr1.api.radio-browser.info/json/tags'. This request has been blocked; the content must be served over HTTPS.
Try fetching using https
:
// HTTPS
fetch('https://fr1.api.radio-browser.info/json/tags')
.then(res => res.json())
.then(console.log)
.catch(console.error);
本文标签: Why does fetch in javascript return netERRFAILED in every caseStack Overflow
版权声明:本文标题:Why does fetch in javascript return net::ERR_FAILED in every case? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745015500a2637814.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论