I have this code, which alerts the user that the window is about to be closed and the user may loose the data. If the user accpets the window closes, if not, the user stays on the page.
<script language='javascript'>
ClosingVar =true
window.onbeforeunload = ExitCheck;
function ExitCheck() {
if(ClosingVar == true) {
ExitCheck = false;
return "YOU MAY LOOSE YOUR DATA.";
}
}
</script>
I want to be able to manage the option of the user. If the accept the closing option, then I want to call a function to do something and then close the window.
Does anyone know how to do this?
Thanks a lot.