Thursday 16 February 2012

Javascript:events: onbeforeunload event

Usage: When closing the tab/browser the onbeforeunload event is triggered. We can confirm the exit or abort it.
<html>
<head>

<script type="text/javascript">
window.onbeforeunload = function() {
  return "dummy string; it won't appear to user...";
}
</script>


</head>


<body>

<p>When closing the tab/browser the onbeforeunload event
is triggered...close the tab/browser....</p>


</body>

</html>

No comments:

Post a Comment