Introduction:
Show alert message to user when closing browser window
Below Code we have to write body tag on window before unload
event call the script function..
<body onbeforeunload = "ConfirmClose(event)">
|
Script:
<script type="text/javascript">
var msg = "Are you sure you want to leave close this page?";
function
ConfirmClose(e) {
var evt =
window.event ? event : e;
if (evt == e) {
if
(!evt.clientY) {
evt.returnValue = msg;
}
}
else {
if (evt.clientY
< 0) {
evt.returnValue = msg;
}
}
}
</script>
|
I hope you like …
0 comments:
Post a Comment