detect when browser is closed

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ziv03
Forum Newbie
Posts: 1
Joined: Sat Apr 02, 2011 4:31 am

detect when browser is closed

Post 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?
Post Reply