Reputation: 43
I am trying to use geolocation in my local HTML file. But it looks like, navigator.geolocation.getCurrentPosition only works with https. I don't know how could I use it in my local HTML file for learning.
Upvotes: 1
Views: 556
Reputation: 2309
A quick solution would be to use a tunneling service like ngrok
. Running ngrok http 12345
with 12345
being your local server port will spin up a tunnel and give you the URL you need to access the tunnelled version of your webserver. ngrok
offers both HTTP and HTTPS.
Upvotes: 1
Reputation: 817
It seems that chrome has security restrictions on accessing geolocation data locally. You need to host the file to use the data..
Upvotes: 0