Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I handle internet explorer buttons in asp.net e.g back, forward
and I want to that when any one click the close button then it display message (ok, cancel)
Posted

Use onbeforeunload event - It is called before the unload event when you click the close button.

An article on similar lines: Save Changes on Close of Browser or When Exiting the Page[^]
 
Share this answer
 
Comments
riteshsingh_jsr 17-Feb-13 2:23am    
Not worked Sandeep....
Sandeep Mewara 17-Feb-13 2:38am    
Don't just copy-paste and then say 'not working'. Seriously it discourages to answer such questions.

That is the event to use. Tie it with a JS method such that when it is raised, ask if they want to close or not.
Similar discussion if you need to know more around it: http://stackoverflow.com/questions/4427714/confirm-dialog-when-i-close-the-browser
 
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