I'm using javascript to fetch some data with the fetch() method:
fetch(url, {
method: 'GET',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: myHeaders,
referrer: 'no-referrer',
}
However it is giving me the following error:
Error:- Access to fetch at 'https://www.dropbox.com/s/v2pca6kq8nsqmso/abb5c48dae55560e4ae7d41af7bfdc50.jpg?raw=1' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
What am I missing?
mode: 'cors',tomode: 'no-cors',as stated in the error message?