title: iPad JavaScript timer stop running detecting sleep mode
body: <p>I am developing a web app (website) that is going to be bookmarked on the home screen it runs a timer/stopwatch but if you lock the iPad then it stops the JavaScript etc. What is the best way to detect when the iPad goes in to sleep mode/ awakens and also how to resume the timer?</p>
  
  <p>I have tried events such as Blur, onload, onunload and also Visibility API any ideas?</p>
  
  <p>I am using HTML5 so tried storing the timer value in local storage but unsure if this is the best approach any ideas or code examples..?</p>
  
  <p>Thanks</p>