topical media & game development

talk show tell print

mobile-game-ch23-watch-position.htm / htm



  <!DOCTYPE HTML>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Watching the position</title>
    <script src='mobile-game-ch23-js-jquery.min.js'></script>
  </head>
  <body>
    <script>
      function logPosition(position) {
        $("#logs").prepend(position.coords.latitude + "," +
                           position.coords.latitude + "<br/>");
      }
  
      function positionError(error) {
        console.log(error);
      }
  
      var watchID = navigator.geolocation.watchPosition(logPosition,positionError,{
        enableHighAccuracy: true
      });
  
      setTimeout(function() {
        navigator.geolocation.clearWatch(watchID);
      },30000);
    </script>
    <div id='logs'></div>
  </body>
  </html>
  
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.