I have written a function which warn a user before refreshing the (I require it for some reason).
What I also want to implement is, call another function if the user clicks on Leave this page. If the user clicks on stay on this page I have to do nothing.
function warnuser()
{
return "Don't refresh the page.";
}
window.onbeforeunload = warnuser;
//if returns true call another function!
Thank you.
If the user decide to leave the page you can’t call functions or anything else, your control is ended…