window.onunload

Javascript window.onunload fires off after Page_Load

I have noticed that window.onunload event fires off AFTER page_load event which makes no sense. This behaviour is creating an issue for me - in my unonload I clear the session, so if the Page_Load first BEFORE onunload, there are errors on the page displayed. I would expect the javascript onunload to fire BEFORE Page_Load....is that t...

ASP.net user control nightmare

I have implemented a user control that I reuse on several pages. However, I have run into variety of issues such as session maintenance across pages, session clearing on navigating away - essentially control state maintenance, that I am wondering that all this is worth the headache. Every time the page is loaded, a control is added to ...

Get url for the page being opened next in window.onunload event

Hi, Is there a way get the location for page being opened next in the window.onunload event. Best Regards, Keshav ...

window.onunload only fires when a tab is closed in firefox, not the entire browser

UPDATE So after reading both of your answers I realize there is no reliable way to determine when a browser window is closed. Originally I was planning to use this to unlock a record in the database when the page is closed. Basically when the user loads the page the record it's accessing locks and then unlocks when the page is closed....