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});
29 geoNavigateIfNeeded('geoStart');
32 function geoGetLastPositionLatitude() {
33 return "" + last_position
.coords
.latitude
;
35 function geoGetLastPositionLongitude() {
36 return "" + last_position
.coords
.longitude
;
38 function geoGetLastError() {
39 return "" + (last_error
? last_error
.code
: 0);
41 function geoSetMaxNavigateCount(max_navigations
) {
43 max_navigation_count
= max_navigations
;
44 return "" + max_navigation_count
;
46 function geoAccessNavigatorGeolocation() {
47 return "" + typeof(navigator
.geolocation
);
52 <input type=
"button" value=
"manual" onclick=
"geoStart()"/>