(function () { typeof console != "undefined" && console.log("access runing"); var closed = false; var timer = null; var pageClose = function () { if (closed) return; closed = true; typeof console != "undefined" && console.log("access closing"); var url = "/Admin/Access/unload.ashx?cl=202104141526430048"; if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } var t = window.acessFinish ? window.acessFinish : 0; url += "&ut=" + t; try { xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = function () { }; xmlHttp.send(null); } catch (err) { } } window.onbeforeunload = pageClose; if (window.addEventListener) { document.addEventListener('visibilitychange', function () { var state = document.visibilityState; console.log("page:" + state); if (state == "unloaded") { //pageClose(); } else if (state == "hidden") { timer = setTimeout(pageClose, 30000); } else if (state == "visible") { if (timer) { clearTimeout(timer); } } }); } })();