Thanks Max
I will instead try to use the Geolocation api directly.
This (see underneath) I have tested and works fine on Firefox newest versions.
You think this will be better to use this then Appery component/service?
It looks like it aborts the timer when onsucces is called (so not both onerror an onsuccess are executed).
function geolocFail()
{
alert('Geolocation failed');
};
if (navigator.geolocation) {
var location_timeout = setTimeout("geolocFail()", 10000);
Code: Select all
navigator.geolocation.getCurrentPosition(function(position) {
clearTimeout(location_timeout);
var lat = position.coords.latitude;
var lng = position.coords.longitude;
alert(lat);
}, function(error) {
clearTimeout(location_timeout);
geolocFail();
});
} else {
// Fallback for no geolocation
geolocFail();
}
(I think I found this somewhere on the stackoverflow site.)
Ole.