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=/';
}
}
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=/';
}
}