PDA

View Full Version : Pop up windows once per browser session


netshop01
03-09-2003, 02:28 AM
Greetings,

This cookie based java-script pops up when a visitor arrives at the site (once per browser session). I would like the pop up to occur when the visitor LEAVES the site.

Can anybody provide an answer?


<script>

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="http://www.1st-in-net-shopping.com/_pop/work.html"
winpops=window.open(popurl,"","width=300,height=300,")
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){
if (get_cookie('poppedup')==''){
openpopup()
document.cookie="poppedup=yes"
}
}

loadornot()
</script>

justame
03-09-2003, 03:58 AM
net...
just a checkout® this link...

http://javascriptkit.com/script/cut65.shtml

n' seeems thattt the ol' key errr javascript of it is...
onunload="loadpopup()"

netshop01
03-09-2003, 04:56 AM
It's not quite what I was looking for. It still pops up when "the first time the surfer enters and leaves the page".

I am looking for a similar solution that pops up when thel leave the site (not page) only.