Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Orlando Florida
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    pop up window when user leaves entire site PLEASE HELP!!!

    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>

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Look at my pop up generator,,,,there is a way to do it for links, BUT it does not keep the window from opening with back button and forward button

    http://www10.brinkster.com/A1ien51/s...UpWinGenV3.htm


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •