Im building a website/webapp that uses sockets.io
Currently if the user is using safari on an iphone for example and they lock the screen (goes black) My socket connection is closed. This is good, I want this.
However when they unlock the screen (or awake from sleep). I would like to detect this event with javascript so I can reconnect my socket.
Is this possible?? Google isn't turning much up on the subject.
Get the navigator. userAgent Property in a variable name userAgent. Check for the 'android' in the userAgent by using RegExp. If the value of Android is not 0 then it is android phone else not android phone.
On your device, go to the Home screen (the one with all the icons), and tap on the Settings icon. Scroll down and tap on About phone or About tablet. Some information will appear. If one of the lines of information says Android with a version number, you have an Android device.
Nevermind, I figured it out
<script>
window.addEventListener("pageshow", function(){
alert("page shown");
}, false);
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With