Skip to content Skip to sidebar Skip to footer

I Have Some Doubts Regarding The Fetch Api In Case Of Errors

I have been experimenting with the fetch api, and it's still not clear when it is rejected. For example when I try the following: fetch('https://stackoverflow.com/') it is rejected

Solution 1:

Be sure that you are not making this request from your browser, you will get a CORS error since the fetched page is not hosted on the same domain as the JS Code.

For testing purposes you can use a CORS plugin that allows requests like that.

Post a Comment for "I Have Some Doubts Regarding The Fetch Api In Case Of Errors"