I am building an app that uses the Geolocation API. I cant seem to get a very simple piece of code to work on Firefox 10. Here is the code:
window.onload = f
I've made this example for you:
if(!navigator.geolocation){
alert('El Navegador no soporta GeoLocalización');
}
function doGeo( position )
{
var coords = position.coords.latitude + '+' + position.coords.longitude;
var url = 'https://maps.google.es/?q=' + coords;
$( "#lat" ).html("Latitud: " + position.coords.latitude );
$( "#lon" ).html("Longitud: " + position.coords.longitude );
$( "#acc" ).html("Precisión: " + position.coords.accuracy );
$( "#alt" ).html("Altitud: " + position.coords.speed );
var link = 'Ir a la Ubicación en Google Maps';
$(link).appendTo('#GoogleMaps');
}
function lost()
{
alert('Algo salió mal, Intentelo más tarde...');
};
navigator.geolocation.watchPosition(doGeo, lost, {maximumAge:0,enableHighAccuracy:true} );
hope it helps!