Apple documentation lists the available iOS browser events here: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
The events of "pagehide" and "pageshow" seem to work fine in safari, but in chrome it only works when loading and unloading a page. This does not work on:
Pressing the Home button, that is, sending Chrome to the background
Tab Switching
Below is a small piece of Javascript code that you can use to test it:
<script type="text/javascript"> window.addEventListener("pageshow", function(evt){ alert('show'); }, false); window.addEventListener("pagehide", function(evt){ alert('hide'); }, false); </script>
What can I do to determine if Chrome has been sent to the background or not. I need to clear the setTimeout timer as soon as Chrome comes to the fore. Are there any workarounds?
javascript google-chrome javascript-events ios dom-events
amit_saxena
source share