Want Exit Popop Not to open inside the same site

D

deepak

I am using the code below to implement 1 time entry and exit popup.
The entry popup works fine, but the exit popup opens even if you
browse from one page to the other on the same site. I want it to popup
only if the user closes the browser or goes to a different site.

What is the best way to implement this ?


var isNN, isIE, loadURLs=new Array(), loadTimes=new Array(), exitURL,
loadURLno=0, scriptID, cookieVRFY;
var exit = true;

//set by user


scriptID='nrScript';
cookieVRFY=1;

AddLoad('entry.asp',1);
//AddExit('exit.asp');


function AddLoad(sURL,iTime)
{
loadURLs[loadURLno]=sURL;
loadTimes[loadURLno]=iTime;
loadURLno++;
}


function AddExit(sURL)
{
exitURL=sURL;
}



if (parseInt(navigator.appVersion) >= 4) {
if (navigator.appName == "Netscape") {
isNN = true;
} else {
isIE = true;
}
}

function errorIgnore(e) { return true; }


function openLoadWin() {
var oldtime=0,mywins;
for (mywins=0;mywins<loadURLno;mywins++)
{

var winLeft = (screen.width)/3;
var winTop = (screen.height)/3;
setTimeout("window.open('" + loadURLs[mywins] + "','Loadwin" + mywins
+ " ','width=350,height=200,top=0,left=0,scrollbars=no
,top = " + winTop + ", left = " + winLeft +"' );self.focus();"
,(oldtime+loadTimes[mywins])*1000+10);
oldtime+=loadTimes[mywins];
}
return true;
}


function openExitWin() {
if (exitURL!='')
{
var ExitWin = window.
open(exitURL,'ExitWin','width=350,height=200,top=0
,left=0,scrollbars=yes');
self.focus();
}
return true;
}



if ( (cookieVRFY!=1) || (document.cookie.indexOf( scriptID+'PopupPRO='
)==-1) )
{

window.onerror = errorIgnore;

if (isNN) {
document.captureEvents(Event.UNLOAD | Event.LOAD | Event.ERROR |
Event.CLICK);
}

openLoadWin();
//window.onunload=openExitWin;

if (cookieVRFY==1){
document.cookie=scriptID+'PopupPRO=HeyGuys!;path=/';
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top