<body onbeforeunload="doUnload()" onmousedown="Relode()"> <form id="form1" runat="server"> </form> </body> <script language="javascript" type="text/javascript"> var isClose = false; document.onkeydown = checkKeycode function checkKeycode(e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; if(keycode == 116) { isClose = true; } } //This code will take care of refresh/rerlode by right click or F5//// Designed by Nawab Ahmad on 25112013....... function Relode() { isClose = true; } alert("relode") //This code is responsible for close window handler//// designed by Nawab Ahmad on 25112013...... function doUnload() { if(!isClose) { alert('window is closing'); } } ////Tested on IE 6,7,8,9,10..... </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)