Mark Logan
Mark Logan

Reputation: 203

navigator.geolocation.getCurrentPosition no longer working in Safari mobile after iOS9 update

I have a web app that has this code for getting the user's coordinates:

if (navigator.geolocation) {
   navigator.geolocation.getCurrentPosition(function(position) {  

But the moment I updated to iOS9 it ceased to work. I'm not even getting the Safari prompt anymore asking permission to get my location. Anyone else having this issue after updating to iOS9 and was able to resolve it?

Upvotes: 2

Views: 6400

Answers (3)

TacoEater
TacoEater

Reputation: 2268

If you are running on a mac, you'll need to enable location services for safari: enable location on OSX

Upvotes: -1

Ramon Imaginanet
Ramon Imaginanet

Reputation: 1

Try enabling localization in the general settings of iOS. Settings > Localization > Press localization to enable it. And now it works.

It seems that iOS 9 has disabled localization in the settings, after installing.

Upvotes: 0

Phunky
Phunky

Reputation: 481

I've noticed this myself and i'm wondering if iOS 9 Webkit has started to prevent this working via HTTP as I know Chrome will be preventing this shortly as it currently throws the following alert in the web console.

getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

Upvotes: 6

Related Questions