0

I am tryibg to get the status code of a url.

fetch(https/**********************).then((response) => { console.log(response.status,"STATUS"); // returns 200 });

200 status code is coming. But 404 status code is not coming.

Instead of that CORS error is coming.

How to get 404 status code?

  • You are getting code 200 beacue the request was success. You only will get 404 when the resource is found. – Jorge Montejo Sep 21 '22 at 11:47
  • but in networks tab , its showing 404 but in console its showing Cross origin error –  Sep 22 '22 at 05:06
  • To avoid CORS during local development i use a extension (https://chrome.google.com/webstore/detail/moesif-origin-cors-change/digfbfaphojjndkpccljibejjbppifbc?hl=en) More info about CORS: https://stackoverflow.com/questions/25845203/understanding-cors – Jorge Montejo Sep 22 '22 at 07:16

0 Answers0