function window.onbeforeunload() 
            {   
                    location.href="../enterQuit.do";
                    alert("这里执行数据库操作");     
             }
在../enterQuit.do我有这样的代码
要怎么样才能在浏览器关闭前保证执行完以下代码呢?
                          request.getSession().removeAttribute("adminInfo");
             request.getSession().removeAttribute("adminInfo");
             request.getSession().removeAttribute("metafuncUrlList");
             request.getSession().removeAttribute("afeephone");
             request.getSession().invalidate();