Click to See Complete Forum and Search --> : popup window on domain exit.


vaibhav
06-14-2004, 11:38 PM
Hi All!

I am using following script to load popup window on domain exit. It will load popup window only when someone leave from my website or close the browser window.

But there is one problem with the script.

When i navigating using the back and forward button it also popup the window.

Any one have any idea.

My script is as below.

<script type="text/javascript">
<!--
var locallink=false;

function setupLinks(){
var j=0;

for (var i=0;i<document.links.length;i++){
if (document.links[i].href.substring(0, 27) == 'http://www.india-herbs.com/'){

document.links[i].onclick = function(){ locallink = true };

}
}
}

function checkExit(){
alert(locallink)
if (!locallink)
window.open('http://www.india-herbs.com/pop.php');
}
// -->
</script>
<body onload="setupLinks();" onunload="checkExit();"


Thanks

Vaibhav