繁体   English   中英

在plunker中没有'Access-Control-Allow-Origin'标题

[英]No 'Access-Control-Allow-Origin' header in plunker

我看到有很多关于No 'Access-Control-Allow-Origin' header 我的问题是关于如何在plunker中解决这个问题。

我在plunker中有一段代码,它试图加载一个外部html文件。 它给出了错误No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://run.plnkr.co' is therefore not allowed access. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://run.plnkr.co' is therefore not allowed access.

我试图通过open /Applications/Google\\ Chrome.app --args --disable-web-security启动Chrome,但它没有帮助。

有没有人有任何解决方法来加载外部html文件在plunker中工作?

您可以使用开放式CORS代理,例如https://cors-anywhere.herokuapp.com/

它的工作方式是,而不是直接向https://site.to.request提出请求,而是向https://cors-anywhere.herokuapp.com/https://site.to.request提出请求。

然后https://cors-anywhere.herokuapp.com/代理添加必要的CORS标头。

或者您可以从源代码运行您自己的实例: https://github.com/Rob--W/cors-anywhere/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM