Smeegs
Smeegs

Reputation: 9224

Why is geolocate failing in safari desktop?

I trying to use geolocation and it's working for all my browsers except for safari.

Here is the script that I'm running.

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function (location) {
        console.log('success');
    }, function () {
        console.log('error');
    });
} else {
    console.log('denied');
}

I've created a fiddle for this as well

I'm running safari 5.1.7 on windows 7 pro. Is there something I'm doing wrong?

Thanks!

Upvotes: 0

Views: 1994

Answers (2)

Jinesh Gandhi
Jinesh Gandhi

Reputation: 77

No you code is right

actually all the browser get the geolocation but only safari browser not getting geolocation if you are using wired connection but if you are using wifi then it will work.

I don't know why this problem occur only in safari browser.I have same problem and I am try for alternate way to get geolocation if any one find alternate way then please post on stack overflow.

Upvotes: 0

brennanyoung
brennanyoung

Reputation: 6524

I don't have an answer. Just want to add a little "me too" with some little fragments.

This is very peculiar. I've had no trouble with this feature for years, wired, wifi, whatever.

Now it has just started failing (Mac Snow Leopard, Safari 5.1.10). Link to fiddle fails, google's example fails, my own code which has been working fine for years also fails. Sometimes it's error code 2, sometimes just a timeout. (I am using timeout of 60000 - one minute).

Works fine on other browsers. Also no problem with iOS Safari connected to the exact same wireless network.

Upvotes: 1

Related Questions