click-to-close window ??

What is the HTML command that closes the window issusing the message:<br />
<br />
"The web page you are viewing is trying to close the window" ?<br />
<br />
How can I change it, so that when you reply NO, it will not close the window, but it will redirect you to a diffrent ULR.<br />
<br />
Thanks for any tip!<br />
<br />
cheers!<!--content-->It's not HTML, it's Javascript, and it's something like this:<br />
<br />
<script type="text/javascript"><br />
document.write('<a href=http://www.webdeveloper.com/forum/archive/index.php/"window_not_closed.html" onclick="window.close();return false;">Close window</a>');<br />
</script><br />
<br />
Adam<!--content-->Adam,<br />
<br />
thanks! <br />
<br />
This command also closes the window:<br />
<body onLoad=" window.close()"><br />
<br />
is that also Javascript?<!--content-->Yes, that is an event handler, which executes the Javascript code "window.close()" when the event fires, i.e. when the page loads.<br />
<br />
Adam<!--content-->Adam,<br />
<br />
so how would you modify this event handler, so that the "NO" response will redirect you to a different location?<br />
<br />
Thanks again!<!--content-->I'm sure adam will be much more creative, by while I am online, it'll be easier just to post a boring one that youcan play with:<script type="text/javascript"><br />
<br />
function newClose() {<br />
if(confirm("The Web page you are viewing is trying to close the window.\n\nDo you want to close this window?")) {<br />
window.opener = top; <br />
window.close(); <br />
}<br />
else {<br />
// user decides not to close window<br />
}<br />
}<br />
<br />
window.onload = newClose<br />
<br />
</script><!--content-->Browsers (or at least MSIE) will show the alert 'The window you are viewing...etc if a javascript is trying to close a window that wasn't originally opened by the parent window (this is a security thing), in which case I'm not sure if you can program a redirect into it. <br />
<br />
Just a thought anyway.<!--content-->well i got most of that code from adam, just implemented it to how the poster wanted it, Mozilla will find a problem with this, ehh too bad, don't use it then :)<!--content-->
 
Back
Top