Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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获取gmail消息-atom提要不工作_Javascript_Http_Web_Feed_Atom Feed - Fatal编程技术网

使用javascript获取gmail消息-atom提要不工作

使用javascript获取gmail消息-atom提要不工作,javascript,http,web,feed,atom-feed,Javascript,Http,Web,Feed,Atom Feed,我正在尝试访问gmail atom订阅源,但似乎无法正常工作。我试过: function testing(){ alert("hi"); getMail = new XMLHttpRequest(); getMail.open('GET','https://mail.google.com/mail/u/0/feed/atom/', true); getMail.onload = function() { var allXML

我正在尝试访问gmail atom订阅源,但似乎无法正常工作。我试过:

function testing(){
    alert("hi");
    getMail = new XMLHttpRequest();
    getMail.open('GET','https://mail.google.com/mail/u/0/feed/atom/', true);
    getMail.onload = function() { 
        var allXML = getMail.responseText;
        alert("hi2");
        alert(allXML);
    }
    getMail.send(null);
}
但是当我运行它时,我看不到hi2,更不用说响应文本了。 我登录到gmail,如果我把https://mail.google.com/mail/u/0/feed/atom/'直接进入浏览器。我正在使用FirefoxV29

我在这里读过之前类似的问题,但没有任何帮助

编辑 现在我进入hi2,但响应文本为空。。。代码是:

function testing(){
        getMail = new XMLHttpRequest();
        getMail.open('GET','https://mail.google.com/mail/u/0/feed/atom/', true);
        getMail.withCredentials = true; 
        getMail.onreadystatechange = function() { 
                if (getMail.readyState == 4) {
                    var allXML = getMail.responseText;
                    alert("hi2");
                    alert(allXML);
                }
            }
            getMail.send(null);
        }

有什么想法吗?

你是从哪家公司经营这项业务的?这是另一个网站吗?浏览器扩展?我的猜测是您遇到了同源策略。@thejh,目前我正在本地提供该页面,因为它正在开发中,但最终我可能会在某个地方托管它。如果是SOP,我能做些什么?谢谢