Frug / AJAX-Chat

A fully customizable web chat implemented in JavaScript, PHP and MySQL which integrates nicely with common forum systems like phpBB, MyBB, FluxBB, SMF and vBulletin. A Flash and Ruby based socket connection can be used to boost performance.
http://frug.github.io/AJAX-Chat/
548 stars 300 forks source link

Feature: Auto-logout on window close #277

Open MikeTodd opened 4 years ago

MikeTodd commented 4 years ago

I've noticed that the chat doesn't automatically log you out if you close the chat window. That's an easy enough to do: just add the following lines after the ajaxChat.init() call:

            window.addEventListener("beforeunload", function(e){
                ajaxChat.logout();
            }, false);
kaaduu commented 4 years ago

Could you put more details where is that line (file) pls? Thanks

MikeTodd commented 4 years ago

@kaaduu it's in ajax-chat/lib/template/loggedIn.html, in the function initialize(), around line 196:

            ajaxChat.init(ajaxChatConfig, ajaxChatLang, true, true, true, initialize);

            window.addEventListener("beforeunload", function(e){
                ajaxChat.logout();
            }, false);

The first line I list should already be present, so you just need to add the lines after that.

Sebastiii commented 2 years ago

Hi, In fact, it doesn't work very when clicking on logout, it does like a loop. Thanks.