I need to perform an action when the user closes a window on my PHP system. I found a JS code that does this in IE, but in Firefox it does not work:
document.onkeydown = fecharIE;
window.onbeforeunload = fecharIE;
//for IE
function fecharIE (evt){
var iX = window.document.body.offsetWidth - window.event.clientX ;
var iY = window.event.clientY ;
if (iX <=30 && iY < 0){
// quando botão de fechar da janela é acionado
sair();
}
if (!evt)
evt = event;
if (event.altKey && event.keyCode==115){
//ALT+F4
sair();
}
}
Does anyone have a solution for Firefox?