Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   what is the script for an exit popup? (https://www.warriorforum.com/programming/575835-what-script-exit-popup.html)

stephanreek 7th April 2012 06:23 AM

what is the script for an exit popup?
 
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?

phpg 7th April 2012 08:46 AM

Re: what is the script for an exit popup?
 
Code:

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


WF99 7th April 2012 11:40 AM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by phpg (Post 5994957)
Code:

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



Thank you Mr. phpg .. Great script ..

stephanreek 8th April 2012 01:54 AM

Re: what is the script for an exit popup?
 
Thank you this really helped me:D

stephanreek 8th April 2012 02:45 AM

Re: what is the script for an exit popup?
 
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?

phpg 8th April 2012 06:27 AM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by stephanreek (Post 5999015)
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>


stephanreek 8th April 2012 08:05 AM

Re: what is the script for an exit popup?
 
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>


phpg 8th April 2012 08:26 AM

Re: what is the script for an exit popup?
 
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.

stephanreek 8th April 2012 09:07 AM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by phpg (Post 6000070)
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

phpg 8th April 2012 09:22 AM

Re: what is the script for an exit popup?
 
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>


stephanreek 8th April 2012 12:10 PM

Re: what is the script for an exit popup?
 
Thanks it works :D

brockmar 31st August 2012 01:12 PM

Re: what is the script for an exit popup?
 
Is this script worth using? Won't it get blocked?

jsjohn96 31st August 2012 11:31 PM

Re: what is the script for an exit popup?
 
You can learn more Javascript in W3Schools

kevinclanton 10th September 2012 12:13 PM

Re: what is the script for an exit popup?
 
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

Ted Burkholder 13th November 2012 09:56 PM

Re: what is the script for an exit popup?
 
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?

Ted Burkholder 14th November 2012 02:02 PM

Re: what is the script for an exit popup?
 
How is this different than exitpop that Andy Fletcher gave away for free?

kevinclanton 14th November 2012 02:35 PM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by Ted Burkholder (Post 7338877)
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

kevinclanton 14th November 2012 02:37 PM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by Ted Burkholder (Post 7338856)
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...

Ted Burkholder 14th November 2012 02:58 PM

Re: what is the script for an exit popup?
 
I'm just not sure why when someone opt's in, they still get the popup. Does this happen on your script also?

Ted Burkholder 14th November 2012 03:01 PM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by kevinclanton (Post 7338812)
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.

kevinclanton 14th November 2012 03:35 PM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by Ted Burkholder (Post 7339117)
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.

alamest 12th November 2013 11:17 AM

Re: what is the script for an exit popup?
 
Do we have to upload in PHP file or HTML file... will it work in both one..

WebdevelopmentGroup 12th November 2013 12:33 PM

Re: what is the script for an exit popup?
 
Theres a few WP plugins for POP UPS. Most PHP scripts are buggy with no direction.

Guillermo-

Daisyonta 13th May 2014 05:19 AM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by stephanreek (Post 5994192)
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;   
 });     }); 


fitnick360 16th February 2016 03:40 PM

Re: what is the script for an exit popup?
 
Quote:

Originally Posted by phpg (Post 6000321)
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?

Jagking 29th February 2016 04:02 PM

Re: what is the script for an exit popup?
 
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?

caubehntinhnghich 29th February 2016 09:42 PM

Re: what is the script for an exit popup?
 
I also have the same questions as you. Thank you for answering :)

Jamesvictor 11th March 2016 12:15 AM

Re: what is the script for an exit popup?
 
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>


All times are GMT -6. The time now is 02:45 PM.