Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.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
Firefox23和IE10不再适合我的XMLHttpRequest,我有php中的COR_Php_Javascript_Xmlhttprequest_Cors - Fatal编程技术网

Firefox23和IE10不再适合我的XMLHttpRequest,我有php中的COR

Firefox23和IE10不再适合我的XMLHttpRequest,我有php中的COR,php,javascript,xmlhttprequest,cors,Php,Javascript,Xmlhttprequest,Cors,我有一个java脚本,它只是从一个网站上获取一个ID,并将其传递给另一个单独域上的php脚本: javascript已打开: 而且会 这或多或少是可行的,我不得不使用以前的跨站点解决方案,而现在在Firefox23和IE10上似乎没有得到认可 以前的解决方案是使用如下内容: var isIE10 = false; //this is beacuse stupid IE10 now does not work with the window.XDomainRequest /*@cc_on

我有一个java脚本,它只是从一个网站上获取一个ID,并将其传递给另一个单独域上的php脚本:

javascript已打开:

而且会

这或多或少是可行的,我不得不使用以前的跨站点解决方案,而现在在Firefox23和IE10上似乎没有得到认可

以前的解决方案是使用如下内容:

 var isIE10 = false; //this is beacuse stupid IE10 now does not work with the window.XDomainRequest
 /*@cc_on
     if (/^10/.test(@_jscript_version)) {
         isIE10 = true;
     }
 @*/
 console.log(isIE10);
 var isIE8 = window.XDomainRequest ? true : false; 

 var invocation=createCrossDomainRequest();

function createCrossDomainRequest(url, handler)
{
        var request;
        if ((isIE8) && (!isIE10)) //tried to hack my own isIE10 fix didnt work
        {
            request = new window.XDomainRequest();
        }
        else
        {
            request = new XMLHttpRequest();
        }
        return request;

}

 function callOtherDomain()
    {
        if (invocation)
        {
            if("withCredentials" in invocation) //was taking a stab in the dark with this.
            {
                invocation.onload=outputResult;
                invocation.open("GET", url, true);
                invocation.send();

            }

            else if(isIE8)
            {
                invocation.onload = outputResult;
                invocation.open("GET", url, true);
                invocation.send();
            }
            else
            {
                invocation.open('GET', url, true);
                invocation.onreadystatechange = handler;
                invocation.send();
            }
        }
        else
        {
            var text = "No Invocation TookPlace At All";
            var textNode = document.createTextNode(text);
            var textDiv = document.getElementById("textDiv");
            textDiv.appendChild(textNode);
        }
    }
function handler(evtXHR)
    {
        if (invocation.readyState == 4)
        {
            if (invocation.status == 200)
            {
                outputResult();                 
            }
            else
            {
                alert("Invocation Errors Occured " + invocation.status + " state: " + invocation.readyState);
            }
        }
    }

    function outputResult()
    {
          var response = invocation.responseText;


                    //get JSON of response
        var obj = JSON.parse(response);
        var mtype = obj.messagetype;
        var output = obj.message;
        var url = obj.url;          

        if(mtype=="error")
        {               
            parent.location=url;
        }
        else if(mtype=="warning")
        {
            var answer=confirm(output);
            if(answer)
                parent.location=url;

        }


        //var textDiv = document.getElementById("textDiv");
        //textDiv.innerHTML += response;

    }       
callOtherDomain(); 所以我不确定这里发生了什么,我在firefox 23的控制台上发现了一个错误:

阻止加载混合活动内容”http://theotherwebsite.edu“

我知道这是因为主脚本是在https上加载的,而不是http。但它以前并不关心。我也知道这个错误在firefox的地址栏上放置了一个屏蔽,用户可以告诉它启用被阻止的内容。这对我来说不是一个可接受的解决方案。另外,如果我把我愚蠢的小php脚本放在https下,那也是我需要的证书吗

那么IE10就不起作用了:

SCRIPT5:访问被拒绝。
landing,第64行421个字符

因此,我不确定我需要做什么才能让我的代码重新工作,让用户调整浏览器是不可行的,因为这是分布在整个企业范围内的,这是为了让他们知道根据php文件通过ajax从网站传递ID访问的某个ldap条目更改密码

我在谷歌上搜索了一下,但什么也没找到,我发现的最多的是php句柄,可以让网站与CORS兼容:

<?php
 header('Access-Control-Allow-Origin: *');

Firefox23+将阻止他们所谓的“活动混合内容”。也就是说:托管在从安全网页(https)请求的非安全(http)位置的内容。在此上下文中,“活动”本质上是指不是媒体类型(不是图像、音频或视频资源)的所有内容。这是为了防止中间人攻击,即使用非安全子请求进入安全页面

有关更多信息,请参阅关于MDN的文章

由于请求在到达网络之前就被阻止,因此不会有任何响应头/数据

不确定IE10,但似乎表明他们出于同样的原因阻止了此类请求,并表示:

不允许跨域、跨端口和混合协议请求


Firefox23+将阻止他们所谓的“活动混合内容”。也就是说:托管在从安全网页(https)请求的非安全(http)位置的内容。在此上下文中,“活动”本质上是指不是媒体类型(不是图像、音频或视频资源)的所有内容。这是为了防止中间人攻击,即使用非安全子请求进入安全页面

有关更多信息,请参阅关于MDN的文章

由于请求在到达网络之前就被阻止,因此不会有任何响应头/数据

不确定IE10,但似乎表明他们出于同样的原因阻止了此类请求,并表示:

不允许跨域、跨端口和混合协议请求


您需要显示更相关的代码,例如您发出实际请求失败的代码。根据浏览器查看请求和响应标题也会很有帮助。更新了相关代码。试图找出IE10中请求和响应头的隐藏位置..我想它在网络下,我单击捕获。虽然我没有看到任何看起来正确的东西,只是控制台中的错误…尝试在firefox 23中找到它时,您需要显示更多相关的代码,例如您发出实际请求失败的代码。根据浏览器查看请求和响应标题也会很有帮助。更新了相关代码。试图找出IE10中请求和响应头的隐藏位置..我想它在网络下,我单击捕获。虽然我没有看到任何看起来正确的东西,只是控制台中的错误…试图在firefox 23中找到它,这有什么原因吗?看起来可能是协议相关链接?这有什么关系吗?看起来可能是协议相关链接?