1

I cant seem to request this url: "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=dogs" from my popup.html.

I'm getting:

XMLHttpRequest cannot load https://ajax.googleapis.com/ajax/services/search/web? v=1.0&q=dogs. Origin chrome-extension://nemobemncffjipfgpaffgiigbjhkpden is not allowed by Access-Control-Allow-Origin.

Here is my manifest:

{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png",
"popup":"popup.html"
},
"permissions": [
"tabs","http://*/","https://*/"
]
}

and my code:

$.ajax({
            type: 'GET', //making a get request
            url:   "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=dogs",
            success: function (data) {
              document.write(data);
            }
            });

Help please, thanks.

4

1 回答 1

4

查看我的 manifest.json 中的权限列:

"permissions": ["tabs", "notifications", "http://*/*", "https://*/*"],

所以,你的 url 格式是错误的,它应该是“http:/// ,而不是“http://*/”。

于 2011-12-26T10:45:12.480 回答