geolocation.html 532 B

123456789101112131415161718192021222324
  1. <html>
  2. <head>
  3. <title>Geolocation</title>
  4. <script>
  5. var positionCount = 0;
  6. var errorCount = 0;
  7. function gotPos(position) {
  8. positionCount++;
  9. }
  10. function errorCallback(error) {
  11. errorCount++;
  12. }
  13. function initiate_getCurrentPosition() {
  14. navigator.geolocation.getCurrentPosition(
  15. gotPos, errorCallback, {});
  16. }
  17. function initiate_watchPosition() {
  18. navigator.geolocation.watchPosition(
  19. gotPos, errorCallback, {});
  20. }
  21. </script>
  22. <body></body>
  23. </head>
  24. </html>