The following logs out only when I have WiFi on. On 4g or any mobile internet type it doesn\'t. Doesn\'t seem so reliable. Any ideas for a better detection of online/offline
This works fine for me:
function isOnline(){ return !(Connection.NONE==navigator.connection.type); }
I hope this helps you!