Categories
Website Design

Show Alert Message before Leaving Page

Show Alert Message before Leaving Page

In this tutorial we will learn how to Show Alert Message before Leaving Page.We will use jQuery for this.

Code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Show Alert Message before Leaving Page</title>
<style type="text/css">
body
 {
 width: 980px;
 margin: 0px auto;
 text-align: center;
 padding-top: 50px;
 font-size: 20px;
 }
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
$(window).on('beforeunload', function() {
return '';
});
});
</script>
</head>
<body>
<form id="form1">
<div>
<b>Welcome to hightechnology.in</b>
</div>
</form>
</body>
</html>