Skip to content

Instantly share code, notes, and snippets.

@hannesoid
Created February 12, 2013 22:35
Show Gist options
  • Save hannesoid/4774122 to your computer and use it in GitHub Desktop.
Save hannesoid/4774122 to your computer and use it in GitHub Desktop.
This is a simple example of an HTML with a javascript timer, which continues to be executed within a UIWebView after the container-app goes to background.
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
var counter = 0;
function increaseCounter() {
counter++;
document.getElementById("count").innerHTML = "" + counter;
}
setInterval(increaseCounter, 1000);
</script>
</head>
<body>
UIWebView has been alive for <span id="count"></span> seconds.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment