5 Replies Latest reply on Jul 8, 2010 6:04 PM by serkan.s.eskici.online.nl

    Logout on browser close

    nickarls

      Hi,


        Some users are surprised at the (correct) behaviour of launching the app from a portal link and when they close the browser without logging off are still logged on when they start the app again from the portal page.


        Has anyone else used some sort of logout on browser close? Some sort of remote call to identity.logout in onUnload?

        • 1. Re: Logout on browser close
          keithnaas

          We have trapped for onBeforeUnload, but not onUnload.  Should be straighforward to code up.


          Are using the remember me functionality in the Identity object?


          • 2. Re: Logout on browser close
            nickarls

            Nope, no remembering.


            Tried hooking onto onbeforeunload but the browser seems to be in a hurry to exit. It see an alert('!') I placed just before the remote call but I never get to the remote method...


            Did you use any callback function or special return value that might have made your case work correctly?


            Thanks in advance,
              -Nik

            • 3. Re: Logout on browser close
              keithnaas

              If the function bound to onbeforeunload returns a non empty string, the browser will prompt the user if they want to leave using the non empty string in the question.


              Not sure if this helps in your case though!

              • 4. Re: Logout on browser close
                nickarls

                The strange thing is that if I call


                
                  alert('1');
                
                  // the remote call
                
                  alert('2');
                
                



                I see the 1, press enter and the browser closes. One would think that at least I would see the 2 (on IE7)

                • 5. Re: Logout on browser close
                  serkan.s.eskici.online.nl

                  OnBeforeUnload won't do it too, because that event is also fired when you press: back, forward, reload, form submit and leave the page by clicking a link.


                  AFAIK there is no waterproof solution for this.


                  I managed to get it work in IE7, but it doesn't work well in FF.