OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Geolocation</title> | 4 <title>Geolocation</title> |
5 <script> | 5 <script> |
6 var positionCount = 0; | 6 var positionCount = 0; |
7 function gotPos(position) { | 7 function gotPos(position) { |
8 positionCount++; | 8 positionCount++; |
9 } | 9 window.document.title = 'Count:' + positionCount; |
10 function initiate_watchPosition() { | 10 } |
11 navigator.geolocation.watchPosition(gotPos, function() { }, { }); | 11 function errorCallback(error){ |
12 } | 12 window.document.title = 'deny'; |
| 13 console.log('navigator.getCurrentPosition error: ', error); |
| 14 } |
| 15 function initiate_getCurrentPosition() { |
| 16 navigator.geolocation.getCurrentPosition( |
| 17 gotPos, errorCallback, { }); |
| 18 } |
| 19 function initiate_watchPosition() { |
| 20 navigator.geolocation.watchPosition( |
| 21 gotPos, errorCallback, { }); |
| 22 } |
13 </script> | 23 </script> |
14 </head> | 24 </head> |
15 <body> | 25 <body> |
16 </body> | 26 </body> |
17 </html> | 27 </html> |
OLD | NEW |