Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

html - Geolocation in Safari 5

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Looks like Safari geolocation only works when connected with wifi. When connected with a wired connection Safari calls the error callback from the geolocation functions.

To test this, try this in the web console:

navigator.geolocation.getCurrentPosition(
  function(){console.log("success")},
  function(){console.log("error")}
);

With Safari/wifi this returns 'success' after a second or two, but on a wired connection it returns 'error' immediately.

( using Safari 5.1 - 8.x / Mac OSX 10.7 - 10.10 )


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...