Skip to content Skip to sidebar Skip to footer

Html5 Geolocation Won't Work In Firefox, Chrome And Chromium

I'm trying to use the HTML5 geolocation API; but I have problems to make it work on Firefox Chrome and Chromium : init(); function init() {; // Get the current location g

Solution 1:

Have you read this ? http://code.google.com/p/chromium/issues/detail?id=41001

At the end of the thread they come to the conclusion that in order to work in Chrome, geolocation must be performed on a device with a working wifi adapter.

Was wifi enabled on your computer ?

(dunno for firefox)

Solution 2:

I have to wait until the document is loaded to get it work in chrome

jQuery().ready(function() {
   if (navigator.geolocation) { 
        navigator.geolocation.getCurrentPosition....
    }
});

Solution 3:

Try this tested in chrome desktop and mobile

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 "Html5 Geolocation Won't Work In Firefox, Chrome And Chromium"