Help with an exit pop-up! Doesn't work?

Discussion in 'JavaScript' started by DrewAMP, Jan 27, 2010.

  1. #1
    Hello,

    I have a product that I am selling, and when someone tries to leave the page, I would for a pop-up to appear asking if they'd like a discount.

    I have obtained the code to do this at, and put it right before the </head> tag.

    Here's what the JavaScript looks like....

    <script type="text/javascript" language="javascript">
    <!--
    var ShowExitPopup = true;
    function ExitPage() {
    	if (ShowExitPopup) {
    		ShowExitPopup = false;
    		location.href = "friendsandfamily.html";
    		return '\n*************************************************\nTodays Special One Time Discount\n*************************************************\n\nWait... Before You Go:\n\nHave a look at this speacial offer, I normally use just for my freinds and family.\n\nToday  Im going to let you have complete access to the XXXXXXX for just $19.97 thats OVER HALF OFF the normal price.\n\nCLICK the CANCEL button below and automatically get your exclusive discount.\n\nThis is a limited TIME offer and may not be here tomorrow. Get Your Access NOW for Just $19.97.To use this One Time discount code simply click on the cancel button below.\n\n*************************************************\nTodays Special One Time Discount\n*************************************************\n';
    	}
    }
    -->
    </script>
    
    Code (markup):

    When I try to leave my site, the pop-up does not appear. It just closes like normal. I want it to have an exit pop-up like you see at myprofitsource.com.

    If you know how to fix this, please let me know! If you send me a PM I will give you the web address to the site I have the code on so you can check it out.

    $5 via PayPal to whoever can help me solve this problem.
     
    DrewAMP, Jan 27, 2010 IP
  2. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hey, this code works :) :

    <script type="text/javascript" language="javascript">
    <!--
    window.onbeforeunload = show_message;
    function show_message()
    {
    	msg = "\n*************************************************\nTodays Special One Time Discount\n*************************************************\n\nWait... Before You Go:\n\nHave a look at this speacial offer, I normally use just for my freinds and family.\n\nToday  Im going to let you have complete access to the XXXXXXX for just $19.97 thats OVER HALF OFF the normal price.\n\nCLICK the CANCEL button below and automatically get your exclusive discount.\n\nThis is a limited TIME offer and may not be here tomorrow. Get Your Access NOW for Just $19.97.To use this One Time discount code simply click on the cancel button below.\n\n*************************************************\nTodays Special One Time Discount\n*************************************************\n";
    	return msg;
    }
    -->
    </script>
    HTML:
     
    Randombase, Jan 27, 2010 IP