The truth is, there is no way to do this. The Mozilla object model supports
it, but Internet Explorer does not. It only supports "onbeforeunload" which
fires any time the *document* is unloading from the window, including, but
not limited to, when the window is closed. There is no existing standard for
it, so as to whether there ever *will* be an "onclose" event in all
browsers, your guess is as good as mine, and I'm not guessing.
A browser will never behave the same way as a desktop application. You can't
prevent people from either accidentally or intentionally closing their
browser. In any application, it is impossible to prevent people from doing
absolutely anything wrong, and closing an application isn't wrong. At a
certain point, you have to expect the user to assume a certain amount of
responsibility for what they do. And that's a good thing.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.
<ta***********@gmail.com> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
Thanks for your reply. But I tried it and it doesnt work. actually
there is no onclose event in javascript for window object. I also found
this discussion on a forum
http://www.thescripts.com/forum/thread431659.html
but they also dont have a concrete answer to how to implement it.
if anybody encountered the same problem please let me know.
thanks
Steve C. Orr [MVP, MCSD] wrote: You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<ta***********@gmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com... > Hi All,
>
> Is there any way to detect that the user is trying to Xout the browser
> window instead of hitting a button. Because in my application I want to
> make it sure that they dont do it either knowingly or accidently.
> Its an ASP.NET application with C#.
>
> Thanks
> Tarun
>