在特定情况下无法在IE上的实时域上设置Cookie


Unable to set Cookies on Live Domain on IE on a Specific Situation

我有一个托管在实时服务器上的项目,其域如下:www.abc.com

在实时域上:我无法在IE(7,8,9,10(中设置cookie - 如下面的代码中所述 - (cookie在IE浏览器上启用(,但能够在Firefox,Chrome,Opera和Safari中设置cookie没有任何问题。服务器时间正确(约旦当前时间(

在本地主机上:饼干在所有浏览器上都完美运行!

我的代码解释如下:

在页面:"localhost/test.php"中,我输入了以下代码来读取 show 的内容.php它驻留在实时服务器中:

<?php foreach (file('http://abc.com/api/show.php') as $o) echo $o ?>

在页面 http://abc.com/api/show.php 中:

<script>
function hookscript(url){
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.src = url || null;
    document.getElementsByTagName("head")[0].appendChild(s);
}

hookscript('http://abc.com/aj/ajax.php?part=1');
</script>   

在页面 http://abc.com/aj/ajax.php 中:

function hookscript(url){
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.src = url || null;
    document.getElementsByTagName("head")[0].appendChild(s);
}
<?php
$part = $_GET['part'];
?>
<?php
if($part==1){
?>
    <?php setcookie('test',time(),time()+3600) ?>
    hookscript('http://abc.com/aj/ajax.php?part=2');
<?php
}
if($part==2){
    if(isset($_COOKIE['test'])){
?>
        alert('Cookies SET');
    <?php
    }
    else{
    ?>
        alert('Cookies NOT SET'); // WHY!
<?php
    }
}
?>

感谢您的提示!谢谢!

我已经解决了这个问题,这是微不足道的。IE的隐私高级设置中未启用第三方设置!