WhiteEagle
asked on
How can I detect that a user has clicked the window close button ?
I need to identify whether a page is being unloaded because the X button in the top right hand corner has been clicked rather than the page is being unloaded because of some other postback event.
How can I do it?
How can I do it?
i don't think you can.
The only way I can think of is to set some session variable whenever they click a link that takes them out of the page. On unload of the page, check the value of the variable--if they used one of your controls the value could be true...if they used a global function (like back, forward or the 'X') the value could be false.
no way to do this with server-side ASP.... The only way I can think of other than using the JavaScript unload event is the onBeforeUnload event, which is IE 5+ only.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Answer by mgfranz
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GaryC123
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Answer by mgfranz
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GaryC123
EE Cleanup Volunteer
A grade of C? For the wrong person? If it didn't answer your question, don't accept an answer.