The page
unload event can be handled using jQuery by adding a handler to the jQuery beforeunload event
as follows.
$(window).bind("beforeunload", function(event) {
// Add your code here.
});
});
Example
Note: Change the reference of the jQuery jquery-1.7.2.js files to point to your local directory.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Page
Unload</title>
<script type="text/javascript"
src="JavaScript/jquery-1.7.2.js"></script>
<script type="text/javascript"
language="javascript">
$(document).ready(function() {
//
// Page
Unload Event Handler
$(window).bind("beforeunload", function(event)
{
alert('Good Bye !!!');
alert('Good Bye !!!');
});
});
</script>
</head>
<body>
</body>
No comments:
Post a Comment