PDA

View Full Version : how to execute a function when web page window is being closed


kotaravitez
08-11-2010, 07:11 AM
Hi guys i need help ,

I want to execute a function when the web page brower window is closed.i want to run a query on database when the user closes the browser window.i think i can do this by running a query in the javascript function.

If any of you has a different approach then pls let me know. I'm developing jsp application. i want to run a query on MySql database when the user closes the window.

_Aerospace_Eng_
08-11-2010, 07:22 AM
Learn to read the rules please. This is the post a javascript forum, not the how do you do this in javascript forum. Either way look into onbeforeunload along with some ajax that will post back to your jsp code. Good luck.