iT3d.
05-25-2012, 04:49 AM
Here's the base code:
<script type="text/javascript">
var exit=true;
function confirmExit()
{
if(exit)
location.assign('special.html');
if(exit)
return "Message Goes Here";
}
</script>
But it doesn't do exactly what I need it to
What I need (and think is possible, I'm just missing how to do it) is to use this script to make sure they're leaving the site (there's more to the script [that is placed on links] to declare what will not trigger it) But instead of returning to the viewer on attempted exit this 'leave or stay on the page' dialog, I think this script would be better if it would return with a regular confirm box - which will display a message and offer to redirect them to the page I want them at using a OK to redirect them, and cancel to just leave the page however they intended.
I tried just playing with the original script but found that Google Chrome and IE would do different things when trying to follow it - which is why I want this to launch a confirm box which I can link a straightforward redirect to.
Any help?
<script type="text/javascript">
var exit=true;
function confirmExit()
{
if(exit)
location.assign('special.html');
if(exit)
return "Message Goes Here";
}
</script>
But it doesn't do exactly what I need it to
What I need (and think is possible, I'm just missing how to do it) is to use this script to make sure they're leaving the site (there's more to the script [that is placed on links] to declare what will not trigger it) But instead of returning to the viewer on attempted exit this 'leave or stay on the page' dialog, I think this script would be better if it would return with a regular confirm box - which will display a message and offer to redirect them to the page I want them at using a OK to redirect them, and cancel to just leave the page however they intended.
I tried just playing with the original script but found that Google Chrome and IE would do different things when trying to follow it - which is why I want this to launch a confirm box which I can link a straightforward redirect to.
Any help?