Javascript window.onunload fires off after Page_Load

Posted by gnomixa on Stack Overflow See other posts from Stack Overflow or by gnomixa
Published on 2010-03-02T00:00:17Z Indexed on 2010/03/15 18:19 UTC
Read the original article Hit count: 463

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 the correct assumption?

TO CLARIFY: Let's assume I am on page test.aspx, then I click on the link that goes to the same page (say I click on a menu), what I observe is that Page_Load fires first, then onunload fires off. Makes no sense at all.

© Stack Overflow or respective owner

Related posts about window.onunload

Related posts about page-load