Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript、Chrome扩展开发、XMLHttpRequest访问控制允许源问题_Javascript_Ajax_Permissions_Google Chrome Extension - Fatal编程技术网

Javascript、Chrome扩展开发、XMLHttpRequest访问控制允许源问题

Javascript、Chrome扩展开发、XMLHttpRequest访问控制允许源问题,javascript,ajax,permissions,google-chrome-extension,Javascript,Ajax,Permissions,Google Chrome Extension,我对这个扩展有一点困惑,尽管这可能是因为我缺乏经验 在我的清单文件中,我有: "permissions": [ "http://mafre.com/","http://eee.se/","http://ilaafire.net/","notifications","tabs" 我使用以下代码发送XML请求: var http = false; http = new XMLHttpRequest(); function replace() { ht

我对这个扩展有一点困惑,尽管这可能是因为我缺乏经验 在我的清单文件中,我有:

"permissions": [
    "http://mafre.com/","http://eee.se/","http://ilaafire.net/","notifications","tabs"
我使用以下代码发送XML请求:

var http = false;
    http = new XMLHttpRequest();

function replace() 
{


            http.open("GET", "http://www.mafre.com/proj/test.php"+getquerystring(), true);
            http.onreadystatechange=function() 
            {

            if(http.readyState < 4) {show_wait_gif();}
                else if(http.readyState == 4) 
                {
                    updatepage( http.responseText);

                }
            }
          http.send(null);
 }
为什么呢?我已经授予它与域交互的权限,所以为什么即使它发送查询,我也无法获得响应

我应该返回到我的页面的回复类似于接受电子邮件,谢谢!一,


谢谢

我认为您应该通配符权限URL,而且www.是一个不同的域:

"http://mafre.com/*",
"http://www.mafre.com/*",

"http://eee.se/*",
"http://www.eee.se/*",

"http://ilaafire.net/*",
"http://www.ilaafire.net/*",

"notifications",
"tabs"

目前,您只能访问http://mafre.com/.

我认为您应该使用通配符权限URL,www.也是一个不同的域:

"http://mafre.com/*",
"http://www.mafre.com/*",

"http://eee.se/*",
"http://www.eee.se/*",

"http://ilaafire.net/*",
"http://www.ilaafire.net/*",

"notifications",
"tabs"

目前,您只能访问http://mafre.com/.

@Ryan:对我来说是的。你重新加载扩展了吗?@Ryan:我上传了最简单的版本,它可以正常工作:。啊!我愚蠢的错误,我打开了两个清单文件,编辑了错误的一个,真是糟糕!片刻您的解决方案非常有效,很抱歉出现上述情况。真希望我能投票支持你的帮助x1000,再投票支持我的愚蠢。再次感谢@瑞恩:对我来说是的。你重新加载扩展了吗?@Ryan:我上传了最简单的版本,它可以正常工作:。啊!我愚蠢的错误,我打开了两个清单文件,编辑了错误的一个,真是糟糕!片刻您的解决方案非常有效,很抱歉出现上述情况。真希望我能投票支持你的帮助x1000,再投票支持我的愚蠢。再次感谢!