-
Check if Geolocation is supported in your browser.
-
If supported, run the getCurrentPosition() method. If not, a message will be displayed.
-
If the getCurrentPosition() method is successful, it returns a coordinates object to the function specified in the parameter (showPosition).
-
The showPosition() function outputs your Latitude and Longitude.
-
Your location will be used to request specific information of the weather to the OpenWeatherMap API.
You can take a look at this project in github
Also you can find the working demo in codepen
Feedback issues etc. are more than welcome! Thanks!