How To Display A Pop Up, When A User Tries To Leave The Current Page?
I want to display a conformation pop up, when user tries to leave the page (close the tab) asking him/her 'You want to leave the page? Yes No'. When the user click the NO, I want t
Solution 1:
window.onbeforeunload = onExit;
functiononExit() {
return"You have attempted to leave this page. Are you sure?";
}
Try this, i have tested firefox and chrome its working not idea about safari.
Solution 2:
Jquery script
<scripttype="text/javascript">
$('#reload').click(function() {
location.reload();
});
$(window).bind('beforeunload', function(){
return'Are you sure to leave the page?';
});
</script>
Post a Comment for "How To Display A Pop Up, When A User Tries To Leave The Current Page?"