Skip to content Skip to sidebar Skip to footer

Navigator.geolocation Getcurrentpositon Isn't Working On Chrome And Firefox

I am following this tutorial online that teaches you how to use the new built in features of HTML5 and google map api to get your current location (Geolocation). ˚

Solution 1:

I use this code works in IE/Chrome/FF mobile browsers almost everything

    if (navigator.geolocation) {
    var latitude = null;
    var longitude = null;
    navigator.geolocation.getCurrentPosition(function (position) {
        latitude = position.coords.latitude;
        longitude = position.coords.longitude;
   });  

 } else {
    alert("Geolocation API is not supported in your browser");
 };

Post a Comment for "Navigator.geolocation Getcurrentpositon Isn't Working On Chrome And Firefox"