Skip to content

Instantly share code, notes, and snippets.

@khorramk
Created January 29, 2021 21:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save khorramk/2c0828ca296832b0319d0155a36af7af to your computer and use it in GitHub Desktop.
Save khorramk/2c0828ca296832b0319d0155a36af7af to your computer and use it in GitHub Desktop.
Client side Cors error fix
fetch(url, {
method: "get", //put your method
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest",
"Access-Control-Allow-Origin": "*"
},
mode: 'no-cors'
});
//Note: works fine in chrome browsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment