[英]How to automatically close the Login window after logged into the homepage
我嘗試了window.close()
函數,它非常適合IE,但不適用於Chrome和Firefox。 在IE中,登錄頁面將自動關閉,但在其他瀏覽器中,登錄頁面將保留,主頁將在新選項卡中打開。 有人可以為此解決方案嗎? 我用來關閉新標簽的功能如下
function quitBox(cmd)
{
if (cmd == 'quit') {
var rand_no = Math.round(1000 * Math.random());
if (window.name == "IMSWindowName") {
windowName = "IMSWindowNameFirst" + rand_no;
windowName = "_self" + rand_no;
} else {
windowName = "IMSWindowName" + rand_no;
windowName = "_self" + rand_no;
}
heightVal = screen.height - 150;
widthVal = screen.width - 150;
newwin2 = window.open('', windowName, 'toolbar=no,status=0,resizable=1,scrollbars=1,top=0,left=0,height=' + heightVal + ',width=' + widthVal + '');
document.forms[0].target = windowName;
document.forms[0].action = 'LogIn';
document.forms[0].method = 'post';
newwin2.focus();
window.opener = 'X';
window.open('', '_parent', '');
var oldURL = document.referrer;
window.close();
}
}
如果要在登錄后關閉“登錄”窗口,則
將登錄窗口作為子窗口打開
然后您可以從其父級關閉它
newwin2 = window.open('',"muk",'toolbar=no,status=0,resizable=1,scrollbars=1,top=0,left=0,height='+100+',width='+100+'');
setTimeout(function(){ newwin2.close() }, 3000);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.