unload function in jQuery works fine in Firefox but not in chrome and safari. please check this fiddle in chrome and Firefox. http://jsfiddle.net/jeevankk/Gywnw/2/ . Alerts a message when the page is refreshed.
$(window).unload(function() { alert("Unload"); });?
This should work to show a confirmation when the users leaves, this is also not part of any standard.
$(window).on('beforeunload ',function() { return 'Are you sure ?'; });
1.4m articles
1.4m replys
5 comments
57.0k users