Show local weather - code issue

Show local weather - code issue
0

#1

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.


#2

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 https://goo.gl/rStTGz for more details.

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


#3

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.


#4

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


#5

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

How do I do this?


#6

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.


#7

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!


#8

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


#9

try one of these, I used Apixu myself.

https://www.apixu.com/

https://darksky.net/dev/


#10

@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.


#11

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.