title: How to keep web page alive on mobile devices?
body: <p>I have a very basic HTML5 page setup for offline use which tells me when it is offline and when it is online.</p>
  
  <p>I've added location tracking to it to record the position of the device while it is running:</p>
  
  <pre><code>function getLocation() {            
      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(success, error);
      } else {
        alert('geolocation not supported');
      }
      setTimeout(function() { getLocation(); },5000);  // calls itself every 5 seconds
  }  
  </code></pre>
  
  <p>This seems to work well, however there is a small problem.</p>
  
  <p>On a desktop browser, you can minimize the page and the location keeps being recorded.</p>
  
  <p>On a mobile device (i.e. iOS), when you minimize the browser, it is suspended i.e. the location no longer gets recorded.</p>
  
  <p>Is there a way to force a webpage to be 'kept alive' on mobile devices?  I know there's a similar feature for apps where you can go back to the homescreen and the app keeps running.</p>
  
  <p>As you can see, this is not a "session being lost" issue, it is simply that all scripts on the page are stopped while the web page is not being viewed.</p>