“No”Access-Control-Allow-Origin'头部存在于所请求的资源上。 [英] "No 'Access-Control-Allow-Origin' header is present on the requested resource."
问题描述
我已经尝试过寻找各种问题,但这并没有帮助/我太缺乏理解,所以我必须具体。
这就是我在控制台中得到的结果:
I already tried looking for various questions, but that didn't help/I am too inexperienced to understand, so I have to be specific. This is what I get in the console:
XMLHttpRequest无法加载 https://a.websight.com/file/hex.json 。请求的资源上没有Access-Control-Allow-Origin标题。因此,'chrome-extension:// asdfghetcetcetc'不允许访问。 (index):1
XMLHttpRequest cannot load https://a.websight.com/file/hex.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://asdfghetcetcetc' is therefore not allowed access. (index):1
这是打破了我的整个扩展,我不知道如何解决它。我很感激任何帮助。
It's breaking my entire extension and I don't know how to fix it. I would appreciate any help.
推荐答案
虽然问题相当古老,但我发现Google开发者网站提供了简单的方法来记住全局类的许可。如果您想在任何可以向清单添加permissions:[< all_urls>]
的地方创建交叉源ajax请求。否则,您可以使用此处中描述的匹配模式。
Although question is quite old, I found that google developer site provide easy way to remember global kind of permission. If you want to make cross origin ajax requests in any where you can add "permissions": ["<all_urls>"]
to the manifest. Or else you can use matching patterns which are described in here.
这篇关于“No”Access-Control-Allow-Origin'头部存在于所请求的资源上。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!