Wednesday, January 22, 2014

Show confirm alert before closing a page using JavaScript

Simple JavaScript code to display confirm alert before a page getting closed.
JavaScript Code:

    <script type="text/javascript">
        window.onbeforeunload = function (e) {
            return "Are you sure you want to close?";
        }
    </script>

No comments:

Post a Comment