12 Replies Latest reply on Jun 8, 2011 6:23 AM by Kumar Pratik

    How to make a user logout when he closes the browser??

    Kumar Pratik Level 1

      Hi,

       

      I wanted to make a user logout or say i wanted to execute code from action script when user closes the browser. I am using the below code but nothing is happening:

       

       

      ACtionScript Code:

      private function init():void

                  {

       

                  ExternalInterface.addCallback("myFlexFunction",myFunc);

                 

                 

                  }

                  public function myFunc():void {

              Alert.show("Logout")'

           }

       

      Java Script Code:

      <script language="JavaScript" type="text/javascript">

      <!–

      // Give user a chance to save modified data

      window.onbeforeunload = clean_up;

      function clean_up() {

      var flex = document.${application} || window.${application};

      flex.myFlexFunction();

      }

      // –>

      </script>

       

      Please let me know where i am doing wrong