我正在玩Quora的API。
我发现这个github存储库用于quora浏览器扩展[https://github.com/drusepth/Quora-Chrome-Extension/blob/master/stable/background.html],它看起来像做GET一样简单http://api.quora.com/api/logged_in_user?fields=notifs,inbox。这应该返回相关的JSON。
但是当我从本地网页尝试相同的代码时,我得到了这个:
Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
为什么会这样?我该如何解决它?
答案 0 :(得分:0)
您需要将api.quora.com域添加到manifest.json文件的权限部分。有关详情,请参阅此处:http://monsur.hossa.in/2011/07/07/chrome-extensions-and-cross-domain-requests.html