Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI,

If I press browser close button, does page_Unload Event fire ?
Reason or Explanation


Many Thanks
Shahnawaz
Posted

No.

Explanation: The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded.
http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]
 
Share this answer
 
You can do it by using java script also like

JavaScript
<script type="text/javascript">

window.onunload = unloadPage;

function unloadPage()
{
alert("unload event detected!");

//call logout button click here.
}
</script>


and also following link might help you..
Window Close Event of Browser
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900