what is the script for an exit popup?

27 replies
Hello warriors,

I always see sites that when you click them away you get a popup that asked you if you really want to leave and if you press no you go to a special offer. I really want this on my website but I have no idea what this script is so could anybody help me? please?
#exit #popup #script
  • Profile picture of the author phpg
    Code:
    <script language="javascript">
    window.onbeforeunload = function() {return '1';}
    </script>
    {{ DiscussionBoard.errors[5994957].message }}
    • Profile picture of the author WF99
      Originally Posted by phpg View Post

      Code:
      <script language="javascript">
      window.onbeforeunload = function() {return '1';}
      </script>

      Thank you Mr. phpg .. Great script ..
      {{ DiscussionBoard.errors[5995819].message }}
  • Profile picture of the author stephanreek
    Thank you this really helped me
    {{ DiscussionBoard.errors[5998899].message }}
    • Profile picture of the author stephanreek
      Do you also know how I can redirect them to another url when they click cancel? And how people who click on a link in the page or the buy now button don't get this popup?
      {{ DiscussionBoard.errors[5999015].message }}
      • Profile picture of the author phpg
        Originally Posted by stephanreek View Post

        Do you also know how I can redirect them to another url when they click cancel? And how people who click on a link in the page or the buy now button don't get this popup?
        Code:
        <script language="javascript">
        (function() {
            var __redirect_to = 'http://YOUR_REDIRECT_URL/';//put redirect URL here
        
            var _tags = ['button', 'input', 'a'], _els, _i, _i2;
            for(_i in _tags) {
                _els = document.getElementsByTagName(_tags[_i]);
                for(_i2 in _els) {
                    if((_tags[_i] == 'input' && _els[_i2].type != 'button' && _els[_i2].type != 'submit') || _els[_i2].target == '_blank') continue;
                    _els[_i2].onclick = function() {window.onbeforeunload = function(){};}
                }
           }
        
            window.onbeforeunload = function() {
                setTimeout(function() {
                    window.onbeforeunload = function() {};
                    setTimeout(function() {
                        document.location.href = __redirect_to;
                    }, 500);
                },5);
                return '1';
            }
        })();
        </script>
        {{ DiscussionBoard.errors[5999679].message }}
        • Profile picture of the author stephanreek
          Thanks, I now have put this code on my website, and the popup does redirect to the other page but it also still gives the popup when somebody clicks on the order button or the links where they can order, does somebody know how to let that go away?

          Code:
          <script language="javascript">
          (function() {
              var __redirect_to = 'http://internetmarketingebooks.eu/';//
          
              var _tags = ['button', 'input', 'a'], _els, _i, _i2;
              for(_i in _tags) {
                  _els = document.getElementsByTagName(_tags[_i]);
                  for(_i2 in _els) {
                      if((_tags[_i] == 'input' && _els[_i2].type != 'button' && _els[_i2].type != 'submit') || _els[_i2].target == '_blank') continue;
                      _els[_i2].onclick = function() {window.onbeforeunload = function(){};}
                  }
             }
          
              window.onbeforeunload = function() {
                  setTimeout(function() {
                      window.onbeforeunload = function() {};
                      setTimeout(function() {
                          document.location.href = __redirect_to;
                      }, 500);
                  },5);
                  return 'WAIT BEFORE YOU GO! CLICK THE *CANCEL* BUTTON RIGHT NOW! . I HAVE SOMETHING VERY SPECIAL FOR YOU COMPLETELY FREE.';
              }
          })();
          </script>
          {{ DiscussionBoard.errors[5999989].message }}
  • Profile picture of the author phpg
    If that doesn't work for you as is, then there is something on your page conflicting with this script, so you'd better tell exact url where you are going to put it.
    {{ DiscussionBoard.errors[6000070].message }}
    • Profile picture of the author stephanreek
      Originally Posted by phpg View Post

      If that doesn't work for you as is, then there is something on your page conflicting with this script, so you'd better tell exact url where you are going to put it.
      Marketing Ebooks - killer web copy this is the url
      {{ DiscussionBoard.errors[6000263].message }}
      • Profile picture of the author phpg
        OK, try this, and place it near the end of your page, right before </body> or </html>

        Code:
        <script language="javascript">
        (function() {
            setTimeout(function() {
            var __redirect_to = 'http://internetmarketingebooks.eu/';//
        
            var _tags = ['button', 'input', 'a'], _els, _i, _i2;
            for(_i in _tags) {
                _els = document.getElementsByTagName(_tags[_i]);
                for(_i2 in _els) {
                    if((_tags[_i] == 'input' && _els[_i2].type != 'button' && _els[_i2].type != 'submit' && _els[_i2].type != 'image') || _els[_i2].target == '_blank') continue;
                    _els[_i2].onclick = function() {window.onbeforeunload = function(){};}
                }
           }
        
            window.onbeforeunload = function() {
                setTimeout(function() {
                    window.onbeforeunload = function() {};
                    setTimeout(function() {
                        document.location.href = __redirect_to;
                    }, 500);
                },5);
                return 'WAIT BEFORE YOU GO! CLICK THE *CANCEL* BUTTON RIGHT NOW! PAGE. I HAVE SOMETHING VERY SPECIAL FOR YOU COMPLETELY FREE.';
            }
            }, 500);
        })();
        </script>
        {{ DiscussionBoard.errors[6000321].message }}
        • Profile picture of the author fitnick360
          Originally Posted by phpg View Post

          OK, try this, and place it near the end of your page, right before </body> or </html>

          Code:
          <script language="javascript">
          (function() {
              setTimeout(function() {
              var __redirect_to = 'http://internetmarketingebooks.eu/';//
          
              var _tags = ['button', 'input', 'a'], _els, _i, _i2;
              for(_i in _tags) {
                  _els = document.getElementsByTagName(_tags[_i]);
                  for(_i2 in _els) {
                      if((_tags[_i] == 'input' && _els[_i2].type != 'button' && _els[_i2].type != 'submit' && _els[_i2].type != 'image') || _els[_i2].target == '_blank') continue;
                      _els[_i2].onclick = function() {window.onbeforeunload = function(){};}
                  }
             }
          
              window.onbeforeunload = function() {
                  setTimeout(function() {
                      window.onbeforeunload = function() {};
                      setTimeout(function() {
                          document.location.href = __redirect_to;
                      }, 500);
                  },5);
                  return 'WAIT BEFORE YOU GO! CLICK THE *CANCEL* BUTTON RIGHT NOW! PAGE. I HAVE SOMETHING VERY SPECIAL FOR YOU COMPLETELY FREE.';
              }
              }, 500);
          })();
          </script>
          I tried this on my website and I'm still getting the exit pop-up when someone clicks the "buy" button. Am I missing something?
          {{ DiscussionBoard.errors[10542359].message }}
          • Profile picture of the author Jagking
            The script works great but I have the same problem with the order buttons. It will not pop when surfing between internal links but on the external order links it will pop open every 4th or 5th click even when I add onclick="exit=false" to the link or variations of that.
            Anyone have any ideas how to stop the popup when clicking on order gifs?
            {{ DiscussionBoard.errors[10564131].message }}
  • Profile picture of the author stephanreek
    Thanks it works
    {{ DiscussionBoard.errors[6001165].message }}
  • Profile picture of the author brockmar
    Is this script worth using? Won't it get blocked?
    {{ DiscussionBoard.errors[6900260].message }}
  • Profile picture of the author jsjohn96
    You can learn more Javascript in W3Schools
    {{ DiscussionBoard.errors[6902686].message }}
  • Profile picture of the author kevinclanton
    JS redirects can be blocked by some browsers (and/or some extensions). I think some versions of IE might have an issue with it (or might cause some issues in the future).. I know that the php script (exitredirect) is more or less useless if they are using IE..

    I think the most effective way of presenting exit offers is displaying a hidden div, and hiding the original pages content, onBeforeUnload that is populated with your exit redirect URL. That way there is no navigation taking place...

    One of the reasons for this, is that the user can see the exit offer (in most browsers) before even before clicking the confirm box (making the decision to stay or go). I found that I get a much higher success rate on my exit offers this way.

    I actually have a wordpress plugin that i wrote that does this. i can put up as a WSO if you all are interested...

    If you are interested Let me know

    jQuery is also really effective for exit offers. And once the script is written it requires less knowledge of html to make it work...

    If anyone wants any code samples of any of these, Let me know or PM me
    {{ DiscussionBoard.errors[6958212].message }}
  • Profile picture of the author Ted Burkholder
    Ok. Here is a exit popup script I found on "Another Forum"

    Code:
    <script type="text/javascript" language="javascript"> 
    var areYouReallySure = false;
    var internalLink = false;
    function areYouSure() {
    if (!areYouReallySure && !internalLink) {
    areYouReallySure = true;
    location.href="REDIRECT URL HERE"
    
    return "*****************************************************nnWait! nnMaybe You're not Interested In My Report , But What About a Chance To Work With Me DIRECTLY? Remember, You're Simply Requesting Information. Also, You Will NEVER Get Spammed From Me!nnWhy Let This Chance Pass You By?nnOn The Next Page Enter Your Name, Email & Phone. I Will Call You PERSONALLY!  nnCLICK CANCEL TO TAKE THE SPECIAL OFFERnn*****************************************************";
    }
    }
    window.onbeforeunload = areYouSure;
    </script>
    The thing is when someone tries to leave the page, everything works great. The PROBLEM is even when someone fills out the optin form on the page, the script sees the user as leaving & the popup opens. Any thoughts on avoiding this?
    {{ DiscussionBoard.errors[7335341].message }}
  • Profile picture of the author JayKnowsCash
    [DELETED]
    {{ DiscussionBoard.errors[7335355].message }}
  • Profile picture of the author kevinclanton
    [DELETED]
    {{ DiscussionBoard.errors[7338812].message }}
    • Profile picture of the author Ted Burkholder
      [DELETED]
      {{ DiscussionBoard.errors[7338856].message }}
      • Profile picture of the author Ted Burkholder
        How is this different than exitpop that Andy Fletcher gave away for free?
        {{ DiscussionBoard.errors[7338877].message }}
        • Profile picture of the author kevinclanton
          Originally Posted by Ted Burkholder View Post

          How is this different than exitpop that Andy Fletcher gave away for free?
          Not sure what you are talking about.. Do you mean in this thread or in another thread? I am not familiar with fletcher.

          But i can say that I wrote this plugin and it is unique in that not only is it a very effective method of presenting multiple exit offers, you can modify the exit content based on time on page.. (IE if they bounce off the page they can see a different exit pop than if they are on the page for 5-10 minutes) which is pretty unique and different..
          I am not aware of anyone else selling something like that
          {{ DiscussionBoard.errors[7339007].message }}
      • Profile picture of the author kevinclanton
        Originally Posted by Ted Burkholder View Post

        Looking for a NON WordPress solution
        Oh for a non wordpress solution you can use the script in this thread.
        Or (if i remember correctly) if you look back through my posts, i have included some similar scripts as well. If i am wrong let me know and i will include one of my stand alone scripts...
        {{ DiscussionBoard.errors[7339017].message }}
    • Profile picture of the author Ted Burkholder
      Originally Posted by kevinclanton View Post

      Here is my WSO that is an exit pop plugin for wordpress,

      http://www.warriorforum.com/warrior-...our-sales.html

      It actually switches out the content on the page instead of bringing up a new window or having to load other content. If the user is on firefox they will actually see the content when they try and exit before clicking the confim (stay or leave) box.

      In addition to being a solid exit pop plugin, it allows you to pick different pop pages based on the user's time on page.

      Let me know if you have ny questions
      would like to see a demo of that. Not the video demo, but an actual demo.
      {{ DiscussionBoard.errors[7339139].message }}
  • Profile picture of the author Ted Burkholder
    I'm just not sure why when someone opt's in, they still get the popup. Does this happen on your script also?
    {{ DiscussionBoard.errors[7339117].message }}
    • Profile picture of the author kevinclanton
      Originally Posted by Ted Burkholder View Post

      I'm just not sure why when someone opt's in, they still get the popup. Does this happen on your script also?
      Not on my pluggin, the pluggin automatically appends javascript to prevent the exit pop if a visitor follows a call to action.

      Not sure if the script i copied to forum has that in it or not.. i certainly have a version of it somewhere...

      Let me know if it doesn't, in the standalone script i wrote, the links have:
      onClick="dontpop();"

      and forms have onSubmit="dontpop();"

      Then i have that function in the script which disables the pop.
      {{ DiscussionBoard.errors[7339273].message }}
  • Profile picture of the author alamest
    Do we have to upload in PHP file or HTML file... will it work in both one..
    {{ DiscussionBoard.errors[8694433].message }}
  • Theres a few WP plugins for POP UPS. Most PHP scripts are buggy with no direction.

    Guillermo-
    Signature
    WebDevelopmentGroup NYC & CA- Small Business Web Development, App Development, WordPress Development, Graphic Designs, Online Marketing, Local Marketing & more!. "Call us 1.800.219.1314 or message us!". Visit us today! "Now On Live Chat Mon-Fri.". www.WebDevelopmentGroup.org
    (Whitelable our Services)
    ===================================
    ==> #1 OFFLINE MARKETING FORUM ON THE WEB! <==
    www.OFFLINEMARKETINGFORUM.com
    (Register Now)
    {{ DiscussionBoard.errors[8694695].message }}
  • Profile picture of the author Daisyonta
    Originally Posted by stephanreek View Post

    Hello warriors,

    I always see sites that when you click them away you get a popup that asked you if you really want to leave and if you press no you go to a special offer. I really want this on my website but I have no idea what this script is so could anybody help me? please?
    PHP Code:
    function PopIt() 
    {          return 
    'Are you sure you want to leave?';     }     
    function 
    UnloadIt() 
    {         
    window.opener.nowDoThisOpener("pass this variable along too");     } 
         $(
    document).ready(function() {         //set the function defining what should be done BEFORE unloading         window.onbeforeunload = PopIt;         //set the function defining what should be done ON unloading         window.onunload = UnloadIt;         //set all links to disable both of these on click         $('a').click(function()
    {              window.onbeforeunload null;             window.onunload=null;   
     });     }); 
    {{ DiscussionBoard.errors[9185631].message }}
  • I also have the same questions as you. Thank you for answering
    Signature
    {{ DiscussionBoard.errors[10564462].message }}
  • Profile picture of the author Jamesvictor
    Hello Warriors,

    In jQuery exit pop-up is:

    <script type="text/javascript">

    $(document).ready(function() {

    $(document).mousemove(function(e) {

    $('#exitpopup').css('left', (window.innerWidth/2 - $('#exitpopup').width()/2));
    $('#exitpopup').css('top', (window.innerHeight/2 - $('#exitpopup').height()/2));

    if(e.pageY <= 5)
    {

    // Show the exit popup
    $('#exitpopup_bg').fadeIn();
    $('#exitpopup').fadeIn();
    }

    });

    $('#exitpopup_bg').click(function(){
    $('#exitpopup_bg').fadeOut();
    $('#exitpopup').slideUp();
    });

    });
    </script>

    <style type="text/css">

    #exitpopup
    {
    text-align:center;
    }

    #exitpopup h1
    {
    margin-top:0px;
    padding-top:0px;

    }

    #exitpopup p
    {
    text-align:left;
    }

    </style>



    <div style="display: none; width:100%; height:100%; position:fixed; background:#000000; opacity: .8; filter:alpha(opacity=0.8); z-index:999998;" id="exitpopup_bg">

    </div>
    <div style="width:670px; height:450px; margin:0px auto; display:none; position:fixed; color:#ffffff; padding:20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; z-index:999999; background:rgb(20, 20, 20); background:rgba(0, 0, 0, 0.8);" id="exitpopup">
    <h1>Wait!!! Before you go...</h1>
    <p>Hello warriors this is the best answer for you<br /><br />

    This is the best alternative for your question</p>
    <a href="#"><img src="letmeinnow.png" style="width:568px; height:190px" border="0" style="border:0px; margin:0px auto;" /></a>

    </div>
    {{ DiscussionBoard.errors[10581364].message }}

Trending Topics