In some cases before page refresh/reload we have to show confirmation message to the user. The page reload only if the user allow. In JavaScript we can use 'onbeforeunload ' function for this case.
I have checked the below code in latest Chrome & Firefox.
Demo
I have checked the below code in latest Chrome & Firefox.
<script>Final code and demo is here
window.onbeforeunload = function(event)
{
return confirm("Confirm refresh");
};
</script>
Demo
No comments:
Post a Comment