views:

51

answers:

2

Hi all,

I have a application which reports my location using HTML5 geolocation. The application works correct on Firefox and Chrome, but on Safari 5, it says that Safari does not support Geolocation.

From what I read, Safari 5 does support Geolocation. What am I missing?

Thanks for your time.

Sunil

+1  A: 

hmmm, I'm a little stumped. Safari 5 does support geolocation through HTML 5. You might want to try to use an HTML 5 feature detection service like Modernizr. This will tell you what browsers support html5 and css3 standards. I'm using Safari 5 and Modernizr shows that the geolocation API is supported.

zPesk
+1  A: 

Although nominally geolocation support in Safari 5 is available on both Mac and Windows, I'm hearing of more issues on the Windows side.

For example, see this similar StackOverflow question. In that case, though, navigator.geolocation was available, it just never received a successful callback. When you say that "it says that Safari does not support Geolocation", who is saying that to you? Are you getting an error callback, is navigator.geolocation null, or have you just read this elsewhere (and if so, where?)?

npdoty
It may be that the user has disabled geolocation features.
Zac Bowling
Yes, that is one possibility, in which case I believe that `navigator.geolocation` should be null.
npdoty
i have a javascript alert setup for cases when geolocation is not available. Chrome and Firefox do not trigger this alert. Only Safari 5 does.
Sunil Shenoy
@npdoty i checked my code again and I see that Safari does return null or undefined as return value. My application captures this state and alerts the user that the browser does not support geoLocation.
Sunil Shenoy
@Sunil That might suggest that Location services are disabled: can you check in your Safari settings? (On a Mac, Safari > Preferences > Security > Location services; should be similar on Windows.) And Firefox and Chrome are returning correct locations on the same machine?
npdoty
Yes Chrome and Firefox work without any problem on the same machine. I checked the preferences on Safari and it is enabled to share locations.Thanks
Sunil Shenoy
At that point I have no other suggestion than to file a bug against Safari: http://developer.apple.com/bugreporter/. If Location Services enabled, navigator.geolocation should be defined, if not, it's a bug. Give them details on your operating system and configuration, of course, as we're obviously not all seeing this behavior.
npdoty
Thanks. I have filed a bug report to Apple. Hoping they fix it soon.
Sunil Shenoy