2011-04-12 100 views

回答

3

如何:

var myWindow = window.open (url); 

if (if (myWindow == null || typeof(myWindow)=='undefined')) 
{ 
    // popup blocker is enabled 
} 
else 
{ 
    myWindow.close(); 
} 
+0

ya謝謝。它會工作,如果我使用window.open()但如果我使用post方法導航頁面,然後如何檢查它..? – SSN 2011-04-12 10:01:00

+0

你可以發佈你目前使用的代碼嗎? – WraithNath 2011-04-12 10:06:58

+0

function Validate() { document.frmlogin.action = url +「test.jsp」; document.frmlogin.submit(); } – SSN 2011-04-12 10:09:37

0

如果使用window.open()打開彈出式窗口,檢查返回值。 根據MDC文檔中心(一個很好的JavaScript參考),如果打開窗口無論出於何種原因都沒有成功,則返回值爲null。

var windowReference = window.open(url); 

查看documentation on window.open這裏。

相關問題