plunker 中没有 'Access-Control-Allow-Origin' header

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.

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

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

您可以使用像 https://cors-anywhere.herokuapp.com/ 这样的开放式 CORS 代理。

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

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

或者您可以 运行 来自 https://github.com/Rob--W/cors-anywhere/

来源的您自己的实例