Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
How can we distinguish between browser close events and
browser refresh events (using icon and F5 key)?
Posted
Updated 7-Feb-10 6:12am
v3

Short answer, you can't as neither one is a single defined 'event'.
For example the onUnload event will be raised when the browser closes BUT it is also called when you navigate away from the page, so not suitable.
 
Share this answer
 
i am gone almost everything to search this but failed .. but i am trying if got anything surely i will post it for you
 
Share this answer
 
Comments
Santosh K. Tripathi 7-May-15 2:40am    
Hi,
did you find anything? i need it.
Here is a solution for that
if there is a postback due to an action on the control, document.getElementByID('__EVENTTARGET') will not be null. So using this hidden field you can know wich control fired the postback in the page.

Else if this a normal refresh then this value will be null always.

So you can check this value in the CodeBehind to know.

Hope this will help you
 
Share this answer
 

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