I am using fake api and getting this well known "No 'Access-Control-Allow-Origin' header is present on the requested resource."
I watched videos and read articles related to this problem but they are showing the solution while they are using their own server (express) and api but I am using a third party API then how I would set headers for it?
The errors:
CodePudding user response:
A temporary shortcut solution: You can use an extension for your browser to solve CORS error. Allow CORS: Access-Control-Allow-Origin
CodePudding user response:
If you are using google chrome, you can simply disable web security during your development:
Open cmd
Go to chrome.exe installation dir (
C:\Program Files\Google\Chrome\Application
is Default dir):cd C:\Program Files\Google\Chrome\Application
Open chrome.exe with --disable-web-security argument:
chrome.exe --disable-web-security
You can find more info for other OS here