Skip to content

Light version: pages open quickly, without the 3D graphics. You are seeing the light version because the 3D graphics would be slow on this device. The content is the same.

Turn on 3D

Preparing the graphics. This can take a moment on the first visit.

Henry Lõiv

Web design & development

Quick Answer

Does fetch mode: no-cors fix a CORS error?

Development 2 min read

Not when your application needs to read the response. mode: "no-cors" can produce an opaque response whose body and headers are not normally available to your JavaScript. It does not grant permission to bypass another API’s policy. 1

The fix depends on who owns the API

For your own API, check allowed origins, methods and headers on the server. Some requests require a preflight before the real request. Credentialed requests cannot simply use a wildcard Access-Control-Allow-Origin: *. 2

For someone else’s API, use its supported browser interface or an authorized server-side integration within the provider’s terms. Do not send customer data through a random public CORS proxy.

Inspect the actual failure

Compare the console message with the response in the Network panel. Determine whether the failure occurs on preflight, a redirect or the final response. Sometimes the visible CORS error accompanies a server error page that lacks the expected headers.

Do not remove authentication or open the entire API to every origin just to make one test succeed. The configuration should match the intended site and operation.

Making a browser warning disappear is not the same as establishing a safe, readable and correctly authorized data exchange.

Related reading

Frontend development and integrations

Sources

  1. MDN: using Fetch and opaque responses
  2. MDN: Cross-Origin Resource Sharing

Fact checked:

Let’s talk about your project

Tell me about your project

Tell me what you’d like to build or improve. You don’t need a finished brief — we’ll work out the scope and next steps together.

01 How can I help?
02 How many pages do you need?
03 Which extras do you need? Choose all that apply
04 When does it need to be ready?
05 Project details
06 Your contact details

Enquiry received

Thank you!

Your enquiry has been received. I usually reply by email within 2 working days.