I am calling this code by this window.onbeforeunload=HandleOnClose;
This is working fine in IE but not in other browsers. This code is specific for IE but this is not working in other browsers. How can we detect close event of browser in all the browser ?
function ConfirmClose()
{
if (isIE7Min) //To check for IE Version 7.0 and above
{
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if ((b && window.event.clientY < 0) || window.event.altKey)
{
if (!self.closed)
{
refresh = true;
}
}
}
else //IE Version 6.0 and below
{
if (event.clientY < 0 && event.clientX < 0)
{
if (!self.closed)
{
refresh = true;
}
}
}
}
/*Function for onunload*/
function HandleOnClose()
{
ConfirmClose();
if (isIE7Min)
{
if ((window.event.clientX > 0 && window.event.clientY < 0) || window.event.altKey)
{
if (refresh == true)
{
window.open("/DealPricingJavaUAT/DealPricingJsp/Home/logout.jsf");
//Code That redirects to the Session Invalidation Page
}
}
}
else
{
if (event.clientY < 0 && event.clientX < 0 || window.event.altKey)
{
if (refresh == false)
{
window.open("/DealPricingJavaUAT/DealPricingJsp/Home/logout.jsf");
// Code That redirects to the Session Invalidation Page
}
}
}
}