How to pop up a message box and redirect when someone closes a window?

Discussion in 'HTML & Website Design' started by virtualmisc, Oct 14, 2009.

  1. #1
    How do I do it?
    I saw this salespage: bustliars.com
    When I close the window, a message box appears and I'm being redirected to the discount
    page.. how do I do it?
     
    virtualmisc, Oct 14, 2009 IP
  2. EternalFury

    EternalFury Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You add:

    onbeforeunload="return ExitPage();"
    PHP:
    to your body element as an attribute.

    ExitPage() is this script:

    
    var ShowExitPopup = true;
    
    
    
    function ExitPage()
    
    {
    
    if (ShowExitPopup) 
    
    { 
    
    ShowExitPopup = false;
    
    location.href = "http://www.bustliars.com/discount.html";
    
    
    
    return '*************************************************\nToday only Special $20 OFF Discount\n*************************************************\n\nI want to offer you a special discount I normally only offer to my friends and family.\n\nYou can get $20 OFF by clicking the CANCEL button below.\n\nYou will get the entire system for only $19.99 \n\nTo get instant access to my special  discount page where you can use the $10 OFF discount code you MUST click on the CANCEL button below.\n\n*************************************************\nTodays Special $20 OFF Discount\n*************************************************\n';
    
    }
    
    }
    
    PHP:
     
    EternalFury, Oct 14, 2009 IP
  3. baronet-a

    baronet-a Active Member

    Messages:
    181
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    I hate when it happens to me, but it is a good way to drive traffic
     
    baronet-a, Oct 15, 2009 IP