1

Hi i am using html5 geolocation to get user current location.it's working fine with all the desktop browsers except safari . it's also working with iphone and ipad ,all the android devices except samsung tablet. it's inter into error callback instead of successcallback. can i have some free javascript library which i can use as fallback for this device for usa users. i know maxmind library but it's response is not so much accurate.if any one have idea than please let me know about that. if u have any better idea to overcome this situation tan let me know . thanx

prabhat
  • 199
  • 1
  • 3
  • 8
  • Check [this][1] page and its solution for your answer. [1]: http://stackoverflow.com/questions/11280946/unable-to-get-gps-coordinates-using-javascript-on-browser-in-android/11298468#11298468 – axs Jul 02 '12 at 19:40

1 Answers1

0

heres the javascript i used for my site which works on every browser i can find in the office.

if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function (position) {
                        latitude = position.coords.latitude;
                        longitude = position.coords.longitude;
                        //call your function that responds to lat & long
                    }, // next function is the error callback
                        function (error) {
                            switch (error.code) {
                                case error.TIMEOUT:
                                    alert("Timeout");
                                    break;
                                case error.POSITION_UNAVAILABLE:

                                    alert("Position unavailable");
                                    break;
                                case error.PERMISSION_DENIED:

                                    alert("Permission denied");
                                    break;
                                case error.UNKNOWN_ERROR:

                                     alert("Unknown error");
                                    break;
                            }
                        }
                        );
                }

With the error checking in that code you should be able to diagnose what the error is from there.

wyo9089
  • 37
  • 8