I have a javascript that pops up a window when the user leaves our home page and it uses cookies to make sure it does not display it more than once. This is great but I need it to only pop up when the user leaves the entire site and not when the user jumps from one page to another in the site. Please help asap, I am trying to get this to work before tomorrow morning. I only have 6 or so pages on the site so if there is a way to put in the script specific urls not to show the pop up when the user goes to them that would be perfect.
To view it live please visit http://www.multiclubmembership.com the script is currently located on the index.php page.
Thanks,
Jonathan Owen
Here is the script, I am putting onunload="loadpopup()" in the body tag,
<script>
function openpopup(){
//configure "signup.php and the window dimensions as desired
window.open("signup.php","","width=315,height=397")
}
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 loadpopup(){
if (get_cookie('popped')==''){
openpopup()
document.cookie="popped=yes"
}
}
</script>
To view it live please visit http://www.multiclubmembership.com the script is currently located on the index.php page.
Thanks,
Jonathan Owen
Here is the script, I am putting onunload="loadpopup()" in the body tag,
<script>
function openpopup(){
//configure "signup.php and the window dimensions as desired
window.open("signup.php","","width=315,height=397")
}
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 loadpopup(){
if (get_cookie('popped')==''){
openpopup()
document.cookie="popped=yes"
}
}
</script>
Comment