Sunday, March 29, 2015

beforeunload confirm using jquery

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
<script src="jquery-1.11.1.min.js"></script>
</head>
<body>
<div id="boroo">
<section>
<article>
hello, world!
</article>
</section>
</div>
<script>
jQuery(window).bind(
    "beforeunload",
    function() {
        return confirm("Do you really want to close?")
    }
)
</script>
</body>
</html>

No comments: