0
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 Firefox 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();
}
}
Someone has the solution for Firefox?
Here we use
firefox
and always works withonbeforeunload
andonunload
.– Guilherme Lautert
In the same way that it is in the code posted?
– Guilherme Dambros
In fact we use direct
window.onunload = function(e){
– Guilherme Lautert