> window.onbeforeunload = bunload; > function bunload() The beforeunload event is also fired on page refresh & when you browse away from the current page.
Also, what happens if the power goes out on the user's computer? Really, there's no way to detect a real "browser close" event in a way that works 100% of the time. The closest thing you can do is to have the browser continually ping the server, then detect the absence of that ping. But that would be extreme overkill for this situation. SH --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---