7 var navigation_count
= 0;
8 var max_navigation_count
= undefined;
10 function geoNavigateIfNeeded(msg
) {
11 if (max_navigation_count
== undefined ||
12 navigation_count
++ < max_navigation_count
) {
14 document
.location
.hash
= '#' + iteration
+ ':' + msg
;
17 function geoSuccessCallback(position
) {
18 last_position
= position
;
19 geoNavigateIfNeeded('geoSuccessCallback');
21 function geoErrorCallback(error
) {
23 geoNavigateIfNeeded('geoErrorCallback');
26 watch_id
= navigator
.geolocation
.watchPosition(
27 geoSuccessCallback
, geoErrorCallback
,
28 {maximumAge
:600000, timeout
:100000, enableHighAccuracy
:true});
31 function geoGetLastPositionLatitude() {
32 return "" + last_position
.coords
.latitude
;
34 function geoGetLastPositionLongitude() {
35 return "" + last_position
.coords
.longitude
;
37 function geoGetLastError() {
38 return "" + (last_error
? last_error
.code
: 0);
40 function geoSetMaxNavigateCount(max_navigations
) {
42 max_navigation_count
= max_navigations
;
43 return "" + max_navigation_count
;
45 function geoAccessNavigatorGeolocation() {
46 return "" + typeof(navigator
.geolocation
);
51 <input type=
"button" value=
"manual" onclick=
"geoStart()"/>