Why isn't my weather App working?

I’m trying to get the temperature and city to display on my codepen, but it doesn’t work? Could somone take a look at my code and tell me whats wrong?

First of all, you need to use https (at least in Chrome) for the Geolocation API to work. If you use https, you will also have to use an API that works over https or use something like cors-anywhere.com (not stable).

I changed it in your pen: https://codepen.io/benjaminvanzwienen/pen/GWpYNq

1 Like

Thank you, How can I know in the future that I need to use https? If I used firefox would my code have worked?

Not sure if there is an error in the console, but I suppose MDN mentions it in the documentation.

I guess, but you could try :wink: