Forum Moderators: open

Message Too Old, No Replies

Blocking an exit pop-up for users with a cookie

my script isn't stopping the pop-ups

         

Trusty

9:16 pm on Feb 26, 2003 (gmt 0)



Hello guys

First at all Iam newbie on programing stuff.
This script below must works after user leave the web site must appear pop-up window, if cookie (let say:livecare) exist in local user PC then pop up doesn't appear.
So script won't work correctly, where is it wrong.
U can paste here some of your similar script.

<Note: line breaks added to window "features" string - Tedster>

<SCRIPT LANGUAGE="JavaScript">

cookie_name = getCookie("livecare")

function getCookie (Name) {
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset!= -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
}

var exit=true;
mystring = "pop";

function leave(){
if (cookie_name == mystring)

{

}
else {
if (exit)open('win-get_access/index.php','MyWindow',
'toolbar=no,location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=450,height=550,left=1,top=1');
}
}
</script>

[edited by: tedster at 5:15 am (utc) on Feb. 27, 2003]

tedster

6:58 am on Feb 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How exactly does this script fail? No pop-ups, or pop-ups to the wrong people?

Trusty

7:20 am on Feb 27, 2003 (gmt 0)




Cookie is already loaded in user PC and this script should block pop-up but doesn't, so pop-up still appear, no matter what.

tedster

8:55 am on Feb 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, but for some reason I'm not wrapping my mind around this script very well. Are you sure the correct string is actually being set in the cookie?