How to logout during onbeforeunload/onunload using Javascript

后端 未结 1 469


        
相关标签:
1条回答
  • 2020-12-21 20:49

    So, I've figured out some issues with my question with the help of Sunil D. The onunload event fires too quickly for my event to be triggered, so I've decided not to include a warning message, but just log the user off all together using the onbeforeunload event:

    <script type="text/javascript">
    
    window.onbeforeunload=before;
    window.onunload=after;
    
    function before(evt)
    {
       var flex=document.${application}||window.${application};
       flex.unloadMethod(); //calls the flex class containing the "unloadMethod()" which
                            //calls the logout.jsp that does the actually dropping of credentials
    }
    
    function after(evt)
    {
    
    }
    
    </script>
    
    0 讨论(0)
提交回复
热议问题