window blur/focus/pageshow/visibilitychange tester by robocat
Detect foreground within iOS/UIWebView or Android/WebView: 1. click [restart], 2. open another tab or open another app or lock device or open another page. 3. Wait say 10 seconds. 4. Go back to page. Note that animationend event occurs - check milliseconds. webkitRequestAnimationFrame would cause performance issues.