2011-04-12 73 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这里。

相关问题