Show the Local Weather - can't use geolocation API on insecure server (

Show the Local Weather - can't use geolocation API on insecure server (

This worked like a charm!

1 Like

I have spent so many hours trying to figure this out. I just can’t do it. I’ve even copied several people’s codes, and tweaked and tried countless combinations to get the damn geo location data.

Can someone just tell me how to do it? I can figure out everything else on my own, I’m just tired of wasting my time trying to figure this out. I have tried every suggestion in this thread, and I keep getting errors. This challenge has driven me insane.


Hi , maybe you can check on mine :

#44 just shows an empty page with “Origin: header is required” written on it for me. So pretty much can’t use the true geolocation of the device because we have to use https, which prevents us from using http API calls (which weathermap has).

To sum it up, we either use ip address location (innacurate sometimes) or use some sort of proxy magic to use real geolocation with weathermap API.


Hi Andren,

This is a new issue, I have been travelling the world for the past 4 months and have not been coding. The cross origin proxy was working before I left, but this seems to be a new issue.

If anyone can offer assistance that would be great!

It seems to be an issue from the crossorigin proxy. Time to start trouble shooting.


If you use html5 geolocation, you must use https, and CORS issue will come. To solve this, just use http and another location api. However, I still don’t know how to solve problem with loc propertiy.


I am using geolocation API with https. I call the owm API like so:

It works.

EDIT: apparently it’s not advised to use it, but I leave the decision up to you. More info is here:–W/cors-anywhere/#demo-server


I ended up using API to get my latitude and latitude numbers. It works in which is not secure (not https).


dude. so much help! thanks!


Thank you so much; saved my app!


Thank you for this GarrusNapp.


Thank you!! works for me too.


hi! this fixed my project too! It was really frustrating, since I had finished this project awhile ago, and occasionally when I went back to it, I had to do some bugfixing with the ajax request. This time was particularly annoying, until I found your post. But I’m having trouble understanding why “” needs to be added. Before, my ajax request worked using just “”. Would you happen to have an explanation why the normal request stopped working?


Arrrr…thank you so much for this! :smiley:



You can use navigator.geolocation and run the app in CodePen and on GitHub


Hello community, I have been trying for 4 hours to make my app work but I can’t do it, I would like some help or advice. The method .getCurrentPosition is not working for me and I do not know why :sleepy::worried:

This is my code

I wait for your answer:pray:

Weather App codepen issues [SOLVED]

I am actually wondering whether it is possible to finish this task without paying for api geolocation services.
those that are free are unreliable or work via http only.

Examples of Weather Apps that were kindly posted here don’t work for me.

@Nims I tried navigator.geolocation but it’s very unreliable showing that I am in another town that is 300kms away.


@RadekKosiada Use it has 50K free requests per month quota which is enough for small-scale work. It’s reasonably accurate to city level.

1 Like

There’s a detailed analysis of all the most popular IP Geolocation APIs that might be useful -


another way to get the user location is by its ip but this is far away as accuracy as geolocation.