Hey Guys, quick question here.
I'm running the script below but Im facing a problem. This is the scripts that when users want to leave your page they get bombed with a little window saying "Are You sure you want to leave this site? Click Cancel to Stay or Continue to Leave"
The script is working fine, the problem comes when the visitor clicks a link on the site they get this window. I want to avoid this. I only want this window to show when the user clicks the close window X. Not when they click the "buy button" or affiliate links.
Does anyone know how to go around this?
Thank You guys in advance. The code is below if someone wants to use it.
I'm running the script below but Im facing a problem. This is the scripts that when users want to leave your page they get bombed with a little window saying "Are You sure you want to leave this site? Click Cancel to Stay or Continue to Leave"
The script is working fine, the problem comes when the visitor clicks a link on the site they get this window. I want to avoid this. I only want this window to show when the user clicks the close window X. Not when they click the "buy button" or affiliate links.
Does anyone know how to go around this?
Thank You guys in advance. The code is below if someone wants to use it.
Code:
<script type="text/javascript" language="javascript">
var areYouReallySure = false;
var internalLink = false;
function areYouSure() {
if (!areYouReallySure && !internalLink) {
areYouReallySure = true;
location.href="http://afflink.com"
return "*****************************************************\n\nBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAH\n\nPress **CANCEL** NOW to get the free trials.\n\n*****************************************************";
}
}
window.onbeforeunload = areYouSure;
</script>