Hi,

I am working on the IE7 bowser. when i close(exit) the browser. i want to need a conformation.
I have written the below code but its working in IE6 only.

code :

<html>
<head>
<script type="text/javascript">
window.onbeforeunload=function(){


if (window.event.clientY < 0 && (window.event.clientX > (document.documentElement.clientWidth - 5) || window.event.clientX < 15) ) {
alert("closing window");
}


}
</script>
</head>
<body>
test
</body>
</html>

pls help me out

Edited 3 Years Ago by happygeek: fixed formatting

Give tis a shot:

//Response.Write("<script>javascript:var w = window.open('clickonce.application','_blank');
w.opener=null;
w.open('','_self');
w.close();
window.open('','_self');
window.opener=null;
window.close();</script>");

This Code may help you

<script type="text/javascript">
window.onbeforeunload = function (evt) {
  var message = 'Are you sure you want to leave?';
  if (typeof evt == 'undefined') {
    evt = window.event;
  }
  if (evt) {
    evt.returnValue = message;
  }
  return message;
}
</script>

hi,

sorry urs code is not working.

I am using IE7 browser. Actually my requirement is if i close(X) the browser then i want to get the conformation same as when i closing the tabs also i want to get the conformation and same as when i close the tabs from the task bar also i need a conformation.

I have written the code but its working only when i close(x) button. i need that two aslo

code :

<html>
<script   language="javascript">
window.onbeforeunload   =   function()     //author:   meizz
{
var   n   =   window.event.screenX   -   window.screenLeft;
var   b   =   n   >   document.documentElement.scrollWidth-20;
if(b   &&   window.event.clientY   <   0   ||   window.event.altKey)
{
window.event.returnValue   =   "";
alert('close');
}
}
</script>

please help me out.

Thanks in advance.

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.