i am trying to code a chat app for my social network and i am using the following module ..


i have coded the rosters(manage who is online) for it ..

but those rosters work only on login/logout .. on login it makes an entry for username in a database and then all the online friends are displayed on the page that appears after login and the record is deleted when the user logouts . but when a user directly closes the browser the database record is not deleted ..

is there a way to do the deletion when the browser closes without logout .. or can anyone give me a tutorial for creating the rosters (manage who is online and so on ..) ..

thanx in advance ,
Sohail .. :)

6 Years
Discussion Span
Last Post by diafol

Logout on close browser is difficult. JS needs to hijack your browser:

window.onbeforeunload = confirmExit; 
function confirmExit()

return "Put your message here!";


Edited by diafol: n/a


Thank u very much ardav , this solved my problem !!!!!! I used alert() instead of return ..

Thanx Again ..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.