Local Weather App Exercise Security (https) Issue

Local Weather App Exercise Security (https) Issue
0

#1

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,
Chris.


#2

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


#3

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


#4

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://


#5

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:


#6

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

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


#7

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

https://www.youtube.com/watch?v=aLKJhOmBjBw


#8

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


#9

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


#10

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


#11

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.