<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
window.onbeforeunload = function(e) {
e = e || window.event;
e.returnValue = "Your message here";
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
You can use the same script on ASP.NET pages too
The pop-up is shown even if you navigate to other page of your own website. I wanted a solution wherein the user will be altered ONLY if he is closing the Browser window. Can you pls provide any pointers?
ReplyDeleteSandeep
http://sandeep-aparajit.blogspot.com