jquery/jquery-mobile — Issue #3428: Remove a page from DOM when it's left
Author: scan
Created: 2012-01-13 08:34:59+00:00
State: open

On my site, I have a socket.io chat. To find out if the user left the page, I listen to the `disconnect` message. With Ajax activated on the jQuery mobile, the page stays in the DOM even when the user clicks somewhere else, so there's no disconnect.

So I tried to "fake" the `disconnect` event by calling `socket.disconnect` on `pagebeforechange`, but that lead to even more problems. `socket.io` seems to be allergic to re-connecting after a disconnect on the same page.

So I had to de-activate the Ajax effects, even for the other sites.

Is there a way to force the page to be removed from the DOM so it's completely reloaded (with script) when the user returns and the `disconnect` is triggered correctly?