Local Weather App Exercise Security (https) Issue

Hi there,

I coded the Weather App locally and I completed it 100%. It’s functional and I have no errors in console. However, when I pasted the code on CodePen, apparently Google doesn’t support getCurrentPosition() method and I can’t make it work. I am at the beginning on my way to a JS Career and it took me a long time to code this app.

How can I make it work without investing a lot of time again? Is there any easy way to solve the issue?
Here is the link to Local Weather App so you can check the code.

Hope will find an easy way!

Thanks in advance,

Just deploy to surge, it should work, they allow the use of SSL for surge.sh domains.

1 Like

Sorry for my dumb question, but what does it mean? Where to deploy?

Your mixed content error is because your codepen is on a secure server, and open weather is not secure.

You can choose a secure api such as weather underground, or you can put your codepen to be http:// instead of https://

1 Like

I tried with http and I receive this error: _“getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.”

I will try your first advice :slight_smile:

I forgot about that, I use weather underground to call by auto ip.

here’s the link: https://www.wunderground.com/weather/api/

I found the sollution!
This guy explains it really good. I’m glad I found him!


Yes most people end up using an IP address lookup for the location data.

1 Like

I’m glad you found it.Some of his videos are very helpful.

1 Like

What can I use next time to code the same App without having this problems? Should I find a secured Weather API?

Yes, I would suggest it, just to avoid headaches.

Google for “secure weather api” to see what your choices are. I like wu because it is fairly clean and easy to use.