Weather App doesn't work anymore. HELP! - Solved

Weather App doesn't work anymore. HELP! - Solved
0

#1

Could you help me with my weather app. https://codepen.io/Ddorab/pen/wJmgKv?editors=1112 It used to work just fine, but I don’t know why it’s not working anymore. I guess that the problem might be the location api. Still can’t figure it out. So any suggestions are so welcome. Thank you!!


#2

Could this have anything to do with it?


#3

Seems like you are right. I get the following error in console

Mixed Content: The page at 'https://codepen.io/Ddorab/full/wJmgKv/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://ip-api.com/json'. This request has been blocked; the content must be served over HTTPS.


#4

Could be… but I have to use another api with https instead of http. And I don’t find one that gives the same answer like city name, country name, coordinates and so on.


#5

So I should use another api. But I haven’t find one yet, I would like to use one that it gives the same result: city name, country name and so on…


#6

You can use Dark Sky Api over https.

For the geolocation you can use navigator.geolocation like in the exercises.

For the city you can use Google API.


#7

Thank you!!! I will try them. And thank you very much for your answers!!


#8

Well I solved it in a way. I added https://cors-anywhere.herokuapp.com/ before http://api.openweathermap.org and for the location I used navigator.geolocation. Here is what I did. https://codepen.io/Ddorab/full/NgqjRd/

Thank you very much for your help!!