0
我完成了與社交網站的登錄,但我遇到了麻煩,我怎樣才能使我的彈出窗口關閉並刷新成功後的父頁面登錄窗口彈出關閉並刷新成功登錄時的父頁面Facebook
這裏是我目前的做法(這可能不會幫助你,但我只是想讓你知道,我已經做了我的工作)這是我的JS:
function PopupCenter(url, title, w, h) {
// Fixes dual-screen position Most browsers Firefox
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 newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow
if (window.focus) {
newWindow.focus();
}
}
我的HTML:
<a href="<?php echo base_url()?>hauth/login/Facebook" target="popup" onclick="PopupCenter('<?php echo base_url()?>hauth/login/Facebook','xtf','900','500'); return false;">
並確定用戶是否連接(位於Hauth /登錄控制器)
if ($service->isUserConnected())
{
log_message('debug', 'controller.HAuth.login: user authenticated.');
$user_profile = $service->getUserProfile();
log_message('info', 'controllers.HAuth.login: user profile:'.PHP_EOL.print_r($user_profile, TRUE));
$data['user_profile'] = $user_profile;
$this->load->view('hauth/done',$data);
}
else // Cannot authenticate user
{
show_error('Cannot authenticate user');
}
關閉彈出窗口,你可以做window.opener前.location.reload(); na – rahul
@Plum這是我的問題我不知道我該如何使用它以及在哪裏放入 –
如何關閉彈出頁面 – rahul