Hi Faf,
Thank you very much for the reply. I think I was too premature to reply about the solution without fully testing on every browser. I will update my answer to tell about the issue with IE8.
And I should have searched the forum better but my bad. But even after trying the option like setting the chat thread to 5 mins after the browser window is closed, it still shows the chat thread in the visitors window for some reason.
And this quick solution works pretty well on all browser except for IE8 at least, it closes the whole thread every time a link is clicked. // Fix Chat Leaves
EventHelper.register(window, 'onbeforeunload', function() {
Chat.threadUpdater.closeThread();
});
You are also right about using the selector #close to register handle for the onClick only for the right selector but because I want the handler to be registered ONLY on the browser window button click, I did that weird way. I tried something like this but even this did not worked:
jQuery(document).ready(function(){
jQuery('a').on('click', function(){
clicked = true;
$this = jQuery(this).attr('id');
if ($this == 'togglesound') {
window.onbeforeunload = null;
} else {
window.onbeforeunload = function () {
jQuery("#close").trigger('click');
};
}
});
});
Thanks.