Here’s something that work in JavaScript for IE (but not very clean).
In the onUnLoad event of the <body> html tag, use the mouse position to determine if the browser close button has been click (x and y coordinates are always negative for this button):
Function unLoadPage ()
{
if ( window.event)
{
if (window.event.clientX < 0 && window.event.clientY < 0 )
{
// do something
document.location.href = '<%= URL %>';
}
}
window.self.close;
}