0 Replies Latest reply on Jul 8, 2009 11:44 PM by groovie

    How to catch closing-browser events with JSF/Rickfaces prope

    groovie

      Dear users,

      we have to code an web application, that will allow their users
      to lock a document for editing. I would like to make sure, that
      these documents are unlocked (asop), when the user closes
      the window or the browser dies, due to network problems
      or a immediate termination (i.e. segv-violoation in the browser).

      (1) One solution -we already noticed- is a servlet inactivity
      timeout, that can be easily set up in the web.xml, that
      gives us a very robust way to handle timeouts for larger
      delay's of user inactivity for i.e. more than 20 minutes.

      (2) Another idea -we noticed- was to use a sort of a browser-
      heartbeat, that allows us to detect a faster connection-lost/starving
      to the browser. But this sollution could cause a higher load
      on the network.

      In additon to this, somebody asked us to implement also a
      browser based functionality. When a user is trying to close the
      browser, a popup dialog shall inform the user, that all changes
      are gonna be lost. If the user confirms this, an action allows to
      unlock the document on the server.
      This functionality has an event consuming philosophy, cause
      a user-destroy could be stopped with some java(script) code
      in the browser.
      I recognized some solutions around the onUnload
      (onBeforeUnload??)in JavaScript.

      Personally i would use a combination of servlet-timeout (solution 1)
      and a sort JavaScript onUnload, but i did not found a perfect solution,
      so here is/are my queston/s:

      + does Richfaces comes with a perfect readymade solution ?
      + how would i code the onUnload JavaScript perfectly using Richfaces
      means ?
      + does somebody has a nice link/url to this issue or any continuative
      tidea ?

      Thanks in advance
      groovy