[blocked] Access to geolocation was blocked over insecure connection to http://localhost:3000

Hi, I’ve upgraded my app to and am using navigator.geolocation.getCurrentPosition() to get location coordinates, which has worked fine previously.

I’m trying to debug locally using Safari and found that it no longer supports this library over http, therefore, running “meteor run ios-device” is of no help.

I’ve also tried debugging on the device or with Safari using a subdomain over https, as follows:
meteor run ios-device --mobile-server https://staging.example.com --settings settings-staging.json --verbose

In Xcode, it usually launches the app under http at localhost:12000, so I think geolocation is getting blocked there as well due to using http.

Additionally, I’ve deployed the app to Galaxy and the logs there are of no help.

What’s the best way to debug this? Any suggestions are greatly appreciated!

I’ve found the error returned by the callback: “Origin does not have permission to use Geolocation service”.

However, I’m not sure how the Origin is being set.

Is it possible one of the packages in your app updated and included browser-policy?
Is it in your .meteor/versions?

I had that happen on one update where a dependent package started including it so it could configure one part it required, but meant all features were now denied by default in the rest of my app :frowning:

Otherwise it sounds like the kind of thing that happens in a browser update

@coagmano - Thanks so much for the prompt reply! I am using browser-policy, although I’m not sure that was the issue. I think Safari recently starting blocking all geolocation (and related navigator apis) when run under http.

At any rate, I solved this by installing the cordova-plugin-geolocation plugin.

Thanks again for the suggestion!

1 Like