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 window.document.title = 'Count:' + positionCount; | 9 } |
10 } | 10 function initiate_watchPosition() { |
11 function errorCallback(error){ | 11 navigator.geolocation.watchPosition(gotPos, function() { }, { }); |
12 window.document.title = 'deny'; | 12 } |
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 } | |
23 </script> | 13 </script> |
24 </head> | 14 </head> |
25 <body> | 15 <body> |
26 </body> | 16 </body> |
27 </html> | 17 </html> |
OLD | NEW |