Géolocalisation google map
Bonjour,
je me suis mis a jQuery mobile et donc a html 5 et javascript.
Je me suis lancé dans la géolocalisation, j'arrive a afficher la map mais je n'arrive pas a me localiser.
je vous met le javascript :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <script type="text/javascript">
function initialize()
{
console.log("init carte google");
var myOptions = { center: new google.maps.LatLng(46.32, 5.04), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP };
map = new google.maps.Map(document.getElementById("map"),myOptions);
}
$('#carte').live('pageshow',function(event, ui){ initialize(); });
if (navigator.geolocation)
{
var watchId =navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
}
else
{
alert("Votre navigateur ne prend pas en compte la géolocalisation HTML5");
}
function successCallback(position)
{
alert(position.coords.latitude);
};
function errorCallback(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
alert("L'utilisateur n'a pas autorisé l'accès à sa position");
break;
case error.POSITION_UNAVAILABLE:
alert("L'emplacement de l'utilisateur n'a pas pu être déterminé");
break;
case error.TIMEOUT:
alert("Le service n'a pas répondu à temps");
break;
}
};
</script> |
les fonctions success et error ne sont jamais exécutées.
Est ce que j'ai oublié quelque chose ?
ps: j'utilise firefox 16.0.
merci d'avance