Show local weather - code issue

Hi All,

Can anyone offer some help please. My code isn’t working and I’m not sure why. I’ve read a few other threads about similar problems and reworked my code, but still no joy.

link here

Any advice/ suggestions appreciated.

look at console:

pen.js:2 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 Deprecating Powerful Features on Insecure Origins - The Chromium Projects for more details.

Codepen is http. geoloaction is http. Find some other way to get user’s location.

You can switch code pen to https, but then you must also use an api that supports https for free, like dark-skies or apixu.

That’s the only way you can geolocate with this project.

1 Like

@IsaacAbrahamson, thanks.

So i get that http requests are not secure and this feature is deprecated but what I’m not clear about is what I can do to fix this issue or how to proceed :confused:

@MARKJ78, thanks [quote=“MARKJ78, post:3, topic:58885”]
You can switch code pen to https,
[/quote]

How do I do this?

You type in https in your browser where it says http. However this is not really the best as codepen defaults to http not https. You can use something other than geolocation to get the users data. Try ip-api.com

Try searching the forums for this, there are countless topics on this issue. Also, you can skip the weather project if you want. In about a months or so it will become optional and is probably not worth the hassle.

1 Like

Hi,

you just turn this:

into this:

and the jobs a good 'en :slight_smile:

when you do this though you’re api request will fail because of a cross origin issue (ie. calling a http api from an https web address). Everyone runs into the same issue. Open-weather doesn’t support https, unless you feel like paying. not so open is open-weather after-all!

2 Likes

@MARKJ78 No, not so open. lol :slight_smile:

1 Like

try one of these, I used Apixu myself.

https://www.apixu.com/

https://darksky.net/dev/

@IsaacAbrahamson @MARKJ78, thanks to both of you for your suggestions, I shall try using another api and finding a better way to get user location :thumbsup:
I do think fcc should start mentioning things like this within the project info.

There is a curriculum update coming in about a month or so. More info will be added, and more confusing projects like the weather project will become optional.

1 Like