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 .. :)

Recommended Answers

All 3 Replies

Member Avatar

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

window.onbeforeunload = confirmExit; 
function confirmExit()

return "Put your message here!";


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

Thanx Again ..

Member Avatar

Okk mark thread solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.