I'm using this script for capture browser close,Tab close event using jquery. It's working only when i'm put alert(); or return stringmeans" return " "; If i am not added any one these it is not working. In all browsers it's working without alert() or return string but i'm facing this problem for only IE. I did checked on IE10,IE 9 also not working.
Am also tested on javascript "before unload event" not wokring for IE but working all browser.
Here's code
var CookieClientID = ""; var CookieUserID = ""; $(window).unload(function () { }); $(window).bind("beforeunload", function () { beforeunloadval++ if (beforeunloadval == 1) { var value = document.cookie.split('|'); CookieClientID = value[7]; CookieUserID = value[8]; if (CookieClientID != "" || CookieUserID != "" || CookieClientID != undefined || CookieUserID != undefined) { try { //BTGUI.WebServices.ConnectionToken.LogoutMethod(CookieClientID, CookieUserID, LogoutMethodSucess); if (Sys.Browser.name == "Microsoft Internet Explorer") { // debugger; Demo.WebServices.Demo.LogDemo(CookieClientID, CookieUserID, LogoutMethodSucess);//working only put alert() or return msg otherwise not working
alert('OK'); } else { Demo.WebServices.Demo.LogDemo(CookieClientID, CookieUserID, LogoutMethodSucess); } } catch (e) { alert(e) } } } return; });
Thanks