|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Determine whether 'onUnload' is triggerred by Refresh event or close browser event
The onUnload event is triggerred both when a user clicks the 'Refresh' button as well as when the user clicks the 'X' (close browser)icon on the browser.
Is there a way, I can stop the 'onUnload' event being called when the 'Refresh' button is clicked . Or is there a way, I can determine whether the user has clicked the 'Refesh' button or the 'X' icon? |
|
#2
|
||||
|
||||
|
To my knowledge, there's no way to do this except perhaps for setting a cookie on the first page load. Then, for each time the page loads, if the cookie exists, suppress some behavior. I'm not sure even this will work, though, since it's an unload handler and you do want it to run if the X is hit.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
With IE you can use event.clientY<0 to know if the event came from the client area or from other part of the window (toolbar or x button)
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Determine whether 'onUnload' is triggerred by Refresh event or close browser event |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|