Page 1 of 1

detect when browser is closed

Posted: Sat Apr 02, 2011 4:37 am
by ziv03
I did this thing:

Code: Select all

window.onbeforeunload = function(){
mysql_query("DELETE * FR.........");
}
and what happened was that the function was called all the time.. not only when I closed the browser..

then I ran this:

Code: Select all

window.onbeforeunload = function(){
alert("window is closed");
}
and the alert showed up only when I closed the browser..

so what's the different?