问题描述
我已经尝试寻找各种问题,但这没有帮助/我太缺乏经验而无法理解,所以我必须具体.这是我在控制台中得到的:
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".(索引):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.
推荐答案
虽然这个问题很老了,但我发现谷歌开发者网站提供了简单的方法来记住全局类型的权限.如果您想在任何可以添加 "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.
这篇关于“所请求的资源上不存在‘Access-Control-Allow-Origin’标头."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!