gator93
05-17-2007, 11:22 PM
I have this code below:
<html>
<head>
<script type="text/javascript">
var stay=confirm("The following site contains appalling material suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit immediately!")
if (!stay)
window.location="http://www.yahoo.com"
</script>
</head>
<body>
Appalling material here
</body>
</html>
Which works great. But I'm wanting this window to come up only when someone clicks away from the site or exits. Basically using this along with the onBeforeUnload function in the body tag.
How can I make this come up only when exiting not when entering a page?
Thanks.
Andrew
<html>
<head>
<script type="text/javascript">
var stay=confirm("The following site contains appalling material suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit immediately!")
if (!stay)
window.location="http://www.yahoo.com"
</script>
</head>
<body>
Appalling material here
</body>
</html>
Which works great. But I'm wanting this window to come up only when someone clicks away from the site or exits. Basically using this along with the onBeforeUnload function in the body tag.
How can I make this come up only when exiting not when entering a page?
Thanks.
Andrew