How to check whether pop up blocker is turned ON or not in a browser using java or Java script Code ?
function check ()
{
document.login.action= url+"test.jsp";
document.login.s开发者_JAVA百科ubmit();
}
I will call this function on click of submit button
How about:
var myWindow = window.open (url);
if (if (myWindow == null || typeof(myWindow )=='undefined'))
{
// popup blocker is enabled
}
else
{
myWindow.close();
}
If you use window.open()
to open the popup, check for the return value.
According to the MDC doc center (a good javascript reference) the return value is null if opening the window didn't succeed for whatever reason.
var windowReference = window.open(url);
See the documentation on window.open here.
精彩评论