Chrome not allowing Ajax request to permitted domains

会有一股神秘感。 提交于 2019-12-25 03:33:03

问题


I'm creating my first Chrome extension, a relatively simple one with some ajax calls.

My manifest is pretty simple:

{
    "name": "Read It Now",
    "version": "0.12",
    "description": "Read it now.",
    "permissions": [
                    "https://readitlaterlist.com"
                   ],
  "app": {
      "launch": {
          "local_path": "index.html"
      }
  }
}

I'm then using jQuery to fetch some simple data from a URL like:

https://readitlaterlist.com/v2/get?state=unread&count=10&apikey=xxx&username=yyy&password=zzz

However, Chrome still rejects it:

XMLHttpRequest cannot load https://readitlaterlist.com/v2/get?state=unread&count=10&apikey=xxx&username=yyy&password=zzz. Origin chrome-extension://cdfeahailioembamnjnikbiemengfgpp is not allowed by Access-Control-Allow-Origin.


回答1:


You have to include the path in your URL match pattern. "https://readitlaterlist.com/*" should fix your problem.



来源:https://stackoverflow.com/questions/8876442/chrome-not-allowing-ajax-request-to-permitted-domains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!