gweidner
asked on
Capturing the window close event
Is there a way to capture the window close event using javascript? Using the 'onbeforeunload' or 'onblur' does not help in my case as the user might navigate to another page in the same application and these events will be fired. Is there an event which is fired only when the browser window gets closed?
hi,
also plz follow this link
http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript
b u d d h a
also plz follow this link
http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript
b u d d h a
ASKER
Thanks Buddha, but onUnload is called whenever the page gets unloaded, be it navigating to another page in the same application or even when the page is refreshed. I am looking for an event which is triggered when the window is closed using the 'X' button.
Add a global.asax file using the Add/New wizard. There is a neat block in there for Application Start and End. Probably would be the Session Start and End events though, as the application could be running for multiple users. The Session is an individual running the program.
ASKER
Hi Nick, I have the global.asax file and i actually want to fire the Session_End event handler even when the user closes the browser window because Session_End does not get fired when the browser window is closed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does this article help?
http://aspalliance.com/1294_CodeSnip_Handle_Browser_Close_Event_on_the_ServerSide.all
http://aspalliance.com/1294_CodeSnip_Handle_Browser_Close_Event_on_the_ServerSide.all
ASKER
Thanks guys, the links were a great help.
try this
<body onUnload=alert('am going'); self.blur();>
b u d d h a