如何解决登录后HybridAuth弹出窗口不会关闭
我正在为我的Yii应用程序使用hybridauth v3,
我认为我有此代码
$popupScript = "function auth_popup( provider,title = 'Authentication Window',w = '500',h = '650' ){
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
var options = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no';
var url = '".Yii::app()->createAbsoluteUrl('/usr/hybridauth/callback')."?provider='+provider;
var authWindow = window.open(url,title,options+',width=' + w + ',height=' + h + ',top=' + top + ',left=' + left);
if (window.focus) {
authWindow.focus();
}
return false;
}";
Yii::app()->clientScript->registerScript(__CLASS__.'#popup',$popupScript,CClientScript::POS_END);
在我的控制器中,我尝试了close()和仍然相同的结果。
// Close pop-up window
echo "<script>
//window.opener.location.replace('".$url."');
//window.close();
window.opener.location.href = '".$url."';
window.open('','authWindow').close();
</script>";
当我使用google登录时,它已登录,但弹出窗口没有关闭。并在弹出窗口中重定向。有人对此有解决方案吗?谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。