在我的网站中,标题包含 twitter 的注销部分。这些注销功能中使用了三个文件。当用户单击注销时,它会打开 twitter 注销 URL,父窗口会刷新并转到 chrome 中的索引页面。
但是在Firefox中父窗口不会刷新。即使在会话销毁后,它也会显示注销,如果我们刷新页面手册,它会显示登录。任何人都可以帮我解决这个问题
头文件.php
<li><a href="javascript:;" onclick="opennewwindow(); clearsession();">Logout</a></li>
function opennewwindow()
{
var mywin=window.open('twitlogout.php','chindhu','width=550,height=350');
}
function clearsession()
{
var req = GetXmlHttpObject();
req.onreadystatechange = function() {
if(req.readyState == 1) {
document.getElementById('status').innerHTML='<img src="images/ajax-loader.gif"/>';
}
if (req.readyState == 4 ) {
if( req.status == 200) {
document.getElementById('status').innerHTML=req.responseText;
}
else
{
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", "clearsession.php", true);
req.send(null);
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
twitlogout.php
<?php
include("header.php");
header("Location:https://twitter.com/#!/logout");
?>
清除会话.php
<?php include("config/dbconfig.php");?>
<meta http-equiv="refresh" content="2;url=<?php echo URLPATH;?>">
<?php
session_start();
unset($_SESSION['id']);
unset($_SESSION['username']);
unset($_SESSION['oauth_provider']);
session_destroy();
?>