Click to See Complete Forum and Search --> : detecting pop-up killers


havey
03-05-2003, 04:40 PM
I'm trying to determine if a window is killed by a pop-up, i found out that alerts don't display with pop-up blockers :eek:

this is my not working attempt below... and suggestions?

poptest.htm
<script>
window.opener.test.testBool.value = "true"
self.close
</script>

main.htm
<script>
function wait(){
//wait a sec
checkWin2()
}
function checkWin2(){
testVal = document.test.testBool.value
if (testVal == "true"){
document.write ("No blocker")
else{
document.write ("Blocker")
}
}
function checkWin(){
popWin = window.open
("poptest.htm", "testWin","height=20,width=20")
setTimeout("wait()",100)
}

<body onLoad="checkWin()">
<form name="test">
<input name="testBool" value="false">
</form>

Dan Drillich
03-05-2003, 06:28 PM
Your code seemed to me closer to a window checking whether its pop-up was closed.
Here is a working code for this case -


<script>

var popWin = null;

function wait(){
//wait a sec
checkWin2();
}

function checkWin2() {
testVal = document.test.testBool.value;
if (popWin.closed)
document.test.testBool.value = "Pop up was closed!";
// alert("Pop up was closed!");

/*
if (testVal == "true"){
document.write("No blocker")
else{
document.write("Blocker")
}
*/
}


function checkWin() {
popWin = window.open("poptest.html", "testWin","height=20,width=20");
setInterval("wait()",1000);
}
</script>

<body onLoad="checkWin()">
<form name="test">
<input name="testBool" value="false">
</form>
</body>

havey
03-06-2003, 09:10 AM
this works with Free Surfer MKII, don't know about others:



main.htm

<script>
function checkPop(){
window.open("check.htm","")
}
</script>
<body onLoad="checkPop()">
<form name="popResult">
<input name="warning" value="Please Turn Off Pop-up blocker">
</form>


check.htm
<script>
window.opener.popResult.warning.value="No Pop-Up Killer Detected"
self.close()
</script>