Suppose I have a site with simple javascript:
t = setInterval( callback, 30*1000 ); var callback = function() { document.write('foobar'); };
If a user visits my site from a mobile device, I wonder if the callback will continue to execute after the page / application is in the background. I know that all mobile devices do not match, so for clarity, you can define some specific scenarios:
- IOS device using Mobile Safari
- IOS device using a native UIWebView app
- Android device in default web application
- Android device using native application with WebView
In what case (if any) of these cases will the user return in an hour to the screen full of foobar s?
Update
- iOS 8+ (just released while writing this) according to this guy :
Now JavaScript continues to execute, even being an inactive tab (timers slow down to 1 s) and even safari to the background.
source share