...

View Full Version : Checking if the new window is blocked.



telmessos
09-24-2008, 08:20 PM
Hello,

I have a self submitting form which opens in a new window using the following code.

<script type="text/JavaScript" language="JavaScript">
document.myform.submit();
</script>

The form tag is as follows:
<form target="_blank" method="post" name="myform" id="myform" action="https://bankssecurewebsiteaddress">
The web site is made with Javascript and ASP.
Is there a way to check if the new window opened or blocked by a popup blocker with Javascript? Or possibly ASP?

Thanks
telmessos

Philip M
09-24-2008, 08:26 PM
var newWin = window.open(.....parameters.....);
if (newWin && newWin.top) {
// popup has opened
} else {
// popup has been blocked
}


Alternatively if you just need to have extra code to run if the window fails to open you can test if (!newWin || !newWin.top).


Quizmaster: In Roman Catholicism, baptism, confirmation and matrimony are three of the seven what?
Contestant: Deadly sins.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum