[英]How to solve CORS error when using fake API?
I am using fake api and getting this well known "No 'Access-Control-Allow-Origin' header is present on the requested resource."
我正在使用假 api 并得到这个众所周知
"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?我观看了与此问题相关的视频并阅读了文章,但他们在使用自己的服务器(快递)和 api 时展示了解决方案,但我使用的是第三方 API 那么我将如何为其设置标题?
The errors:错误:
If you are using google chrome, you can simply disable web security during your development:如果您使用的是 google chrome,您可以在开发过程中简单地禁用 web 安全性:
Open cmd打开 cmd
Go to chrome.exe installation dir ( C:\Program Files\Google\Chrome\Application
is Default dir): Go 到 chrome.exe 安装目录(
C:\Program Files\Google\Chrome\Application
是默认目录):
cd C:\Program Files\Google\Chrome\Application cd C:\Program Files\Google\Chrome\Application
Open chrome.exe with --disable-web-security argument:使用 --disable-web-security 参数打开 chrome.exe:
chrome.exe --disable-web-security chrome.exe --disable-web-security
You can find more info for other OS here您可以在此处找到有关其他操作系统的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.