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

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.