Hi, I noticed that www.meebo.com has the ability that when you close the browser during a session, it prompts you , are you sure you want to close? How does it do this? I would like to use such an ability , so that if the user preempts a close on the browser, I can kill all threads I have running for that user. Thanks -- Posted via http://www.ruby-forum.com/.
On 7/10/06, Randomuser <user@user.com> wrote:> > Hi, > > I noticed that www.meebo.com has the ability that when you close the > browser during a session, it prompts you , are you sure you want to > close? > > How does it do this? I would like to use such an ability , so that if > the user preempts a close on the browser, I can kill all threads I have > running for that user.That''s not really Rails-specific, but you may wish to look for info on JavaScript/onclose: http://www.google.com/search?hl=en&q=javascript+onclose&btnG=Google+Search There may be other ways to do it, but ''onclose'' is one. Thanks I hope that helps. Sincerely, James Anderson. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060710/530baffa/attachment.html
Randomuser wrote on 10.07.2006 22:30:> Hi, > > I noticed that www.meebo.com has the ability that when you close the > browser during a session, it prompts you , are you sure you want to > close? > > How does it do this? I would like to use such an ability , so that if > the user preempts a close on the browser, I can kill all threads I have > running for that user.onUnload JavaScript
* Randomuser (user@user.com) [060710 15:33]:> How does it do this? I would like to use such an ability , so that if > the user preempts a close on the browser, I can kill all threads I have > running for that user.(See other post in this thread for a JavaScript means of alerting on .close()) If you mean you wish to clean up server-side threads, then be sure to have some other failsafe means of performing the task -- if the client is not JavaScript enabled, has JavaScript turned off, or simply drops off the Internet (or in dozens of other scenarios) then no notification will be coming from the user to tell the server to clean up their threads. FWIW, I''d probably greasemonkey to /dev/null anything that behaved even remotely like that example site''s behavior. $0.02. :-) Rick -- http://www.rickbradley.com MUPRN: 670 | than would be the case random email haiku | if they renewed with Go | Daddy Software.
Using the Javascript onunload definitely isn''t 100% perfect. It''s got so many browser compatibility issues. After trying to use this piece of javascript, we ended up with other techniques to end sessions aside from onUnload to act as a fail safe measure. For a time, when we were contemplating on how meebo was using onUnload, we were even thinking if that confirmation box/alertbox honestly had any logic behind it (was it really closing sessions) because it sure was difficult to work with. Just some thoughts. Thanks, Bing -- Posted via http://www.ruby-forum.com/.