On iOS8 this HTML5 web app does not resume the js timer after the screen is locked and then unlocked if the webapp was active AND launched from the homescreen icon. On iOS7 the timer would continue in this situation. I need the timer to continue after the screen is unlocked - any tips to achieve this?
Note/ Please add the web app to the homescreen first using Safari's "add to home screen" via the sharing button. Running the page inside Safari does not cause the issue described above.
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Test</title>
<script>
var tim;
function go() {
tim = window.setInterval(action, 1000);
}
function action() {
document.getElementById('x').innerHTML = new Date().getTime().toString();
}
</script>
</head>
<body onload="go()">
<div id="x"></div>
</body>
</html>
Installing iOS 8.1.1 fixes this problem
The solution we ended up does not address all the broken functionality after sleep mode in IOS8, but rather just ajax requests/setTimeout/setInterval/requestAnimationFrame and their respective clear functions.
I have a semi-abstracted version on my github available for others. We are using the github version in our fairly complex/large and heavily animation+ajax dependent application with very few issues.
https://github.com/TaDaa/IOS8-FIX
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