shailo — 2013-06-26T15:11:57-04:00 — #1
Hi, this is my first post, I have a chat script wehere the user have to click a icon to leave, but some times (most of the times) they close the browser and the operator ignore it.
The idea is...when the user close the browser a function onBeforeUnload trig the link to make the class "closedthread" id"closedthread" bacome false without click.
I tried it with: <body class="closedthread" id"closedthread" onBeforeUnload="return false;">, but it works ONLY in IE9.
felgall — 2013-06-26T17:38:43-04:00 — #2
Most browsers now limit what onbeforeunload can be used for because a lot of sites misuse it. Also some people disable that event in their browser because of the annoying way it is misused.
The only guaranteed way to determine if the web page is still open or not is to use a heartbeat script to track from the server whether the page is still open or not.
shailo — 2013-06-26T19:29:34-04:00 — #3
Thank you for the answer, but the chat have that already and check for window open every 1 minute, what I was thinking is about something like this:
window.onbeforeunload = confirmExit;
\\ Here -> body return false;
return message to display in dialog box;
With the confirmation alert make the body or the link return false.