jQuery.ajax call fails inside Chrome extension

前端 未结 4 1536
时光说笑
时光说笑 2020-12-28 21:56

I\'m porting one of my Firefox extensions to Chrome, and I\'m running into a little problem with an AJAX query. The following code works fine in the FF extension, but fails

4条回答
  •  孤城傲影
    2020-12-28 22:35

    The accepted answer is outdated.

    Content scripts can now make cross-site XMLHttpRequests just like background scripts!

    The concerning URLs need to be permitted in the manifest:

    {
      "name": "My extension",
      ...
      "permissions": [
        "http://www.google.com/"
      ],
      ...
    }
    

    You can also use expressions like:

    "http://*.google.com/"
    "http://*/"
    

    to get more general permissions.

    Here is the Link to the documentation.

提交回复
热议问题