Skip to content
Advertisement

How to resolve CORS error in Fetch API js

I want to fetch json from my subdomain (File Hosting Server) , but it gets the following error:

Reason: CORS request did not succeed)

(Reason: CORS header ‘Access-Control-Allow-Origin’ missing

my similar code:

JavaScript

I add

JavaScript

but don’t work.

I add

JavaScript

to code, fetch file but return response status 0 , mode: ‘opaque’.

please help me.

Advertisement

Answer

CORS is configured through server-side, so you need to configure on your File Hosting Server

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement