我看到有关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,但没有帮助。
有人有任何解决方法可以使加载外部HTML文件在Plunker中工作吗?
您可以使用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/