Help on onbeforeunload event to alert on close of window(X)

  • Thread starter Thread starter RJN
  • Start date Start date
R

RJN

Hi

I have a pop-up window which has a task menu on its left which are
nothing but links to different screens. This window also has a close
button. On click of close button I do some server side operation and the
window closes itself. Now the user can close the window by clicking on
X(Top right corner) or by pressing Alt+F4 window. I want to atleast
alert the user when he does these 2 things to inform he has not clicked
on the close button. I tried using onbeforeunload event. The problem
with this event is it gets fired whenever the user navigates to a
different url by using the task menu. Any help is highly appreciated as
it has become critical now.

Regards

RJN
 
you are on the right track, there is no browser close event, only page
unload (which happens on a navigation or postback). all valid submits
(postbacks) should disable your unload event handler.

-- bruce (sqlwork.com)
 
Back
Top