Show Alert Message while leaving from webpage using jQuery

In this article, we are showing alert message while leaving the web page.  

Source code:-

<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="webpage.aspx.cs" Inherits="webpage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>jQuery Show Alert Message while leaving from webpage
</title>
    <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" runat="server">
    <div>
        <b> Welcome in Code solution </b>
    </div>
    </form>
</body>
</html>

Out Put:-



Show Alert Message while leaving from webpage using jQuery Show Alert Message while leaving from webpage using jQuery Reviewed by NEERAJ SRIVASTAVA on 11:20:00 PM Rating: 5

No comments:

Powered by Blogger.