How do I get the longitude and latitude of a user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I get the longitude and latitude of a user?

I am using the Geolocation API in HTML5 to show the user their longitude and latitude. However it constantly tells me that the location is unavailable even though I am allowing the request to show my location. Anyone knows what to do to fix this? My research tells me I need to uses https:// but I am not sure how this applies. UPDATE: This is my code: https://code.sololearn.com/WKqjh3x7B6W9 I am now getting a latitude and longitude but I am not sure if it is working correctly.

1st Jul 2017, 2:58 PM
Kevin Oudai
Kevin Oudai - avatar
0 Answers