1

I'm working on http://multiorgasmiclover.com/video-staging/. When a user leaves the page, I have a message displayed in a popup window. However, I don't want the pop-up window to display when someone clicks "Click to Order Now".

Below is my JavaScript:

var exit=true;
    function confirmExit()
            {
            if(exit)
            location.assign('');
            if(exit)   
            alert('**Are you sure you want to LOSE YOUR CHANCE to learn these powerful seduction secrets?\n\nOnce you leave the page your spot WILL be given to the next guy...\n\nThe ONLY way to learn these Top Secret Sexual Attraction Secrets is to STAY on this page...\n\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \nCLICK THE *STAY ON THIS PAGE* BUTTON ON THE NEXT PAGE\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n');     
        return "ARE YOU SURE YOU WANT TO LEAVE???\n\nWithout these secret psychological tricks, your success with women may NEVER improve...\n\nSo if you want to STAY and learn all of these POWERFUL DARK SECRETS of attraction...\n\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \nCLICK THE *STAY ON THIS PAGE* BUTTON BELOW\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n";

            }
            function falseExit(){
var exit=false;
}
if (exit=true){
window.onbeforeunload = function(){ 
return confirmExit();
}
}

Heres the WordPress Page Code:

<img class="aligncenter size-full wp-image-283" alt="Oh-My-God" src="http://multiorgasmiclover.com/wp-content/uploads/2012/12/Oh-My-God2.gif" width="810" height="105" />
<center>
<div class="evp-video-wrap" id="evp-865501268b67db9f71b5c2660cc36771-wrap"></div>
<script type="text/javascript" src="http://adtrack1122.com/evp/framework.php?div_id=evp-865501268b67db9f71b5c2660cc36771&amp;id=ZGVjMTh2My0xLm1wNA%3D%3D&amp;v=1356555658&amp;profile=default"></script><script type="text/javascript">// <![CDATA[
_evpInit('ZGVjMTh2My0xLm1wNA==[evp-865501268b67db9f71b5c2660cc36771]');
// ]]></script>
<script>
function falseExit(){
var exit=false;
}
</script>
<script type="text/javascript" src="http://multiorgasmiclover.com/popup.js"></script>

</center>
<center><a href="http://1.multiorg.pay.clickbank.net/?cbfid=9791"  ><img alt="" src="http://multiorgasmiclover.com/images/clicktoorderbutton.PNG" onclick="falseExit()"></a></center>
<noscript><iframe src="https://ssl.clickbank.net/pitch/serv/customfooter.htm?footerKey=L9QMXQFANN2D"
width=100% style= "padding:0px;margin-top:10px" frameborder="0" scrolling="no"></iframe></noscript><script type="text/javascript">// <![CDATA[
    footerPath='https://ssl.clickbank.net';
    footerKey='L9QMXQFANN2D';
// ]]></script>
<script charset="UTF-8" type="text/javascript" src="https://ssl.clickbank.net/script/custom_footer.js"></script><script type="text/javascript" src="http://multiorgasmiclover.com/popup.js"></script>
Alex Block
  • 315
  • 1
  • 4
  • 15
  • http://stackoverflow.com/questions/147636/best-way-to-detect-when-a-user-leaves-a-web-page – Average Joe Jan 07 '13 at 02:28
  • 1
    `if (exit=true)` should be `if (exit==true)` or better, `if (exit)` – Hui Zheng Jan 07 '13 at 02:29
  • 6
    Why do you think displaying that (annoying) message to your users is a good idea? – Blender Jan 07 '13 at 02:31
  • I'm using onbeforeunload and amde those corrections. However, I don't want the popup to display when the Click to Buy image is clicked. It should go directly to the checkout. However if a user leaves the landing page, a popup should be displayed. – Alex Block Jan 07 '13 at 02:34
  • This is a a client of mine. I just do the programming work, but I am stuck. – Alex Block Jan 07 '13 at 02:34
  • Basically I need to accomplish if user clicks image{ go straight to checkout} if user exits websites{ display popup message}. I tried to execute function falseExit() when the onclick of the Click to Buy image. – Alex Block Jan 07 '13 at 02:36
  • 1
    Ugh. Clients are clients and the content you're working with isn't your fault... still, seeing the content of the message makes me not want to help (any little thing we can do to stop these annoying messages is humanistic imo, and I'm guessing I'm not alone on this one). I woud suggest next time you ask for help to remove your actual text and use placeholders instead. Luckily for me I don't have the answer you seek anyway, so can avoid this internal conflict altogether :) – kristina childs Mar 26 '13 at 19:32

0 Answers0