I was wondering if such a script exists. I have been searching the forums but had no luck (Or I could be blind).
Note: This is for desktop LPs.
Basically, I want an exit pop to activate when user clicks "x" to close tab. It has some message blabla. And if user clicks "stay on the page" nothing happens.
If user clicks "leave this page" , it redirects user to target URL.
This is the exit pop script I am using now. It redirects when user clicks "Stay on page". I am not sure how to modify it to redirect only when user clicks "Leave this page".
<script>
var __redirect_to = 'http://blablabla';
window.onbeforeunload = function(){
setTimeout(function() {
window.onbeforeunload = function() {};
setTimeout(function() {
document.location.href = __redirect_to;
}, 500);
},5);
return 'ARE YOU SURE YOU WANT TO LEAVE?\n\nPRESS "STAY ON THIS PAGE" IMMEDIATELY!';
}
function exception(){
window.onbeforeunload = function() {null};
alert("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
</script>
Any expert coders, please help?
Thanks 
I want one also!!!! 
One that whatever choice someone makes (Stay or leave) it will always redirect to "offer page" / "target URL"