Help my weather app please

Help my weather app please
0.0 0

#1

I’ve been told the geolocation is depreciated but I can still console.log the lat and long just fine. The JSON data doesn’t seem to be translating for some reason. Any ideas?
Thanks!


#2

I had the same issue, and decided to use “http://freegeoip.net/json/” for the location instead.

You can get around it by forcing the codepen to be secure “https” but the run into other problems…

Good luck!


#3

It isn’t. Browsers are updating their security policies to disable data sharing services (geolocation in particular) over HTTP connections. Your AJAX call isn’t working because you must use HTTPS for geolocation to work and you cannot access an endpoint over HTTP if your site is hosted over HTTPS. This comes up frequently on this forum and I suggest a search if you want more details. Try prepending a CORS proxy onto your API URL:

http://cors-anywhere.herokuapp.com/http://api.openweathermap.org/yadda/yadda

Cors-anywhere is a server that intercepts your data and does some magic and stuff. Hopefully that will help.


#4

Thank you so much!! That worked. YAY!!! Been working on that for 3 days. grrrrr


#5

Will be starting the weather app again soon, glad this was brought up!