How to fix the geolocation issues with chrome on CodePen

How to fix the geolocation issues with chrome on CodePen
0

#1

Hi guys,

I’ve realised that my wetaher app doesn’t work any more due to Chrome not allowing geolocation on an unsecure network. This is whta I get when I console log my project (on chrome):

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.

Is there any way around this?


#2

Replace Geolocation with ip-api.com.


#3

consider switching your application to a secure origin, such as HTTPS

Set your codepen’s address to https and use weather API which supports https (e.g. Weather Underground)


#4

Ok thanks, But how do i do that?


#5

IP-API also return a json which includes location coordinates. You can use those coordinates to get weather. In short you will need to have Two Ajax/Json request on your app. One for IP-API and other for Weather.

Or you may use @jenovs solution.