title: Prevent iOS mobile safari from going idle / auto-locking / sleeping?
body: <p>In an iOS app you can set <code>application.idleTimerDisabled = YES</code> to prevent the phone from auto locking.  </p>
  
  <p>I need to do this in mobile safari for a game like Doodle Jump where the user may not touch the screen for an extended period of time.  Is there any documented method or hack to do this?</p>
  
  <p>(Update)
  They seem to be doing it somehow in this site <a href="http://www.uncoveryourworld.com" rel="noreferrer">http://www.uncoveryourworld.com</a>. Visit from your iphone and when you get to the buildings/street scene with music playing in the background just leave your phone alone. It never goes to sleep.</p>
  
  <p>(Update 2)
  I've spent some time taking a closer look at how they might be keeping the phone from going to sleep. I've done a barebones test and it seems that the way they are looping the audio in the street scene is what keeps it from going to sleep. If you'd like to test this just put a simple audio player that loops on your page and click play:</p>
  
  <pre><code>&lt;audio src="loop.mp3" onended="this.play();" controls="controls" autobuffer&gt;&lt;/audio&gt;
  </code></pre>
  
  <p>Everywhere I searched it is being said that this isn't possible, so it is nice to see there is at least some way to do it even if a bit of a hack. Otherwise a browser based game with doodle-jump style play would not be possible. So you could have a loop in your game/app if appropriate or just play a silent loop.</p>