Hello everybody!
(hello, Dr. Nick)
Seriously - I have this site written in Flash and PHP and one part of it has to pop up in its own window (Gaa - not a popup?!?) - yeah, a popup. But the client gets what the client wants. So Microsoft has this bit of Javascript that's supposed to demonstrate how to pop a window and see if there are any errors caused by popup blockers - EXCEPT, the error handling doesn't seem to handle. Bend your orbs around some of this code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Popup Tester</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P><INPUT type="button" value="Open" onclick="openWin()"></P>
<P><INPUT type="button" value="ShowHelp" onclick="showPopup()"></P>
</form>
</body>
<script language=javascript >
function openWin()
{
try
{
window.open("
}
catch (e)
{
alert("Popup window blocked " + e.number);
}
}
function handlePopupErrors()
{
window.alert("Error occurred");
window.navigate(" return true;
}
function showPopup()
{
window.onerror = handlePopupErrors;
window.open("
}
</script>
</HTML>
My environment is Windows XP with SP2. When I turn the popup blocker on high the above code doesn't popup the window and doesn't catch any errors. Now, I'm not much of a Javascripter - so I'm kinda stumped. If this makes sense to you and you feel like sharing, you'll have my eternal gratitude (or at least until I get stumped with something else).
Love,
cyclegeek
(hello, Dr. Nick)
Seriously - I have this site written in Flash and PHP and one part of it has to pop up in its own window (Gaa - not a popup?!?) - yeah, a popup. But the client gets what the client wants. So Microsoft has this bit of Javascript that's supposed to demonstrate how to pop a window and see if there are any errors caused by popup blockers - EXCEPT, the error handling doesn't seem to handle. Bend your orbs around some of this code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Popup Tester</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P><INPUT type="button" value="Open" onclick="openWin()"></P>
<P><INPUT type="button" value="ShowHelp" onclick="showPopup()"></P>
</form>
</body>
<script language=javascript >
function openWin()
{
try
{
window.open("
}
catch (e)
{
alert("Popup window blocked " + e.number);
}
}
function handlePopupErrors()
{
window.alert("Error occurred");
window.navigate(" return true;
}
function showPopup()
{
window.onerror = handlePopupErrors;
window.open("
}
</script>
</HTML>
My environment is Windows XP with SP2. When I turn the popup blocker on high the above code doesn't popup the window and doesn't catch any errors. Now, I'm not much of a Javascripter - so I'm kinda stumped. If this makes sense to you and you feel like sharing, you'll have my eternal gratitude (or at least until I get stumped with something else).
Love,
cyclegeek