I need to find browser close button click event in my web application. I need to show some alert message on that event. I tried to do it using window.onbeforeunload event, but it gets called on every page navigation or page refresh I need to execute that function only on close button click event
Asked
Active
Viewed 1,883 times
1
-
1Have you tried onbeforeunload? http://stackoverflow.com/questions/6622461/how-to-capture-browser-close-event-in-javascript – Ricky Nelson Sep 16 '13 at 11:10
-
Check this post. Checks to see if user has clicks link or submitted form http://stackoverflow.com/a/1632004/2637902 – Papa Sep 16 '13 at 11:12
-
Check this fiddle http://jsfiddle.net/PSLuP/ – Chirag Vidani Sep 16 '13 at 11:16