Click to See Complete Forum and Search --> : Pop Up on Site Exit Only
lanidex2
06-03-2003, 12:28 PM
We're trying to make a pop up window open on site exit only, i.e., if user closes the browser, types in a new address in the browser, clicks on an external link, etc.; problem is that the pop up opens from page to page within the site, i.e, when moving from one page to another or clicking on internal links within the site. I've browsed old threads on this, but still cannot get it to work. Here's what we have :
<!-- Begin
function leave() {
window.open('popup.html','','toolbar=no,menubar=no,location=no,height=420,width=430');
}
// End -->
</SCRIPT>
</head>
<BODY onUnload="leave()">
Any help would be GREATLY appreciated.
Charles has posted a solution to this problem a while back... http://forums.webdeveloper.com/showthread.php?s=&threadid=4083
lanidex2
06-03-2003, 02:04 PM
The pop up on exit works, but we're getting errors on the page, would someone mind taking a look:
<script type="text/javascript">
<!--
window.onunload = function () {window.open('popup.html','','toolbar=no,menubar=no,location=no,height=420,width=430');
}
/* the following will, once the document is loaded, step through all of the links on the page and set each link, when clicked, to clear the above handler */
window.onload = function () {for (var i=0; i<document.links.length; i++) {document.links[i].onclick = function () {window.onunload = function () {}}}}
// -->
</script>
Thank You!
Charles
06-03-2003, 02:11 PM
There's nothing wrong there that I see. Please post a link to the whole page.
lanidex2
06-03-2003, 02:14 PM
Here is the link to the page; I've been looking at it for so long, and I can't find what would be causing the error.
http://www.zedinteractive.com/clients/par/index.html
Charles
06-03-2003, 04:20 PM
Your error is this piece of illegal JavaScript in the BODY tag, onunload="function()" . Rid yourself of it and all will be well.
lanidex2
06-06-2003, 11:44 AM
Thank you Charles!