[PSA] If you are having issues with your location API

Try two things:

NO LONGER RECOMMENDED***remove the ‘s’ from https://codepen.io/yadayadayda so that it looks like http://codepen.io/yadayadayada

Edit: Use Geolocator but make sure you have https enabled. See post from AbdiViklas below

If you have some kind of adblocker enabled or installed, try disabling it or uninstalling for the time being.

I was going crazy when my weather app stopped working all of the sudden even after I hadn’t changed anything and after performing step 1. Figured out that Ublock Origin was breaking it.

It’s better to keep a secure connection to CodePen and call your API through an SSL proxy, like https://crossorigin.me. If you force your user to use in insecure connection, you won’t be able to use the browser’s geolocation services.

1 Like

if you use crossorigin on a location api (at least with http://ip-api.com in codepen it will not return with your address. I kept getting New York, and im in CO.

Well, yes, but you should be using the browser’s geolocation service. IP-based, third party location services are more difficult to use, less secure, and way less accurate.

Well that has been one of the issues with this challenge. We are unable to use googles location api as well (is that what you were talking about?). It seemed that the only other working reccomendations I’ve found to work was one of these ip location apis. This challenge has caused a lot of people a whole lot of issues because of it. This challenge should be replaced by another because with where chrome is at security-wise and the use of codepen it seems like a lot of campers have resorted to workarounds that dont apply to realworld situations

Yeah, it’s frustrating for sure. This sort of security restriction is going to be the standard before too long, and was recently added to Safari as well. All of this adds another layer of complexity that isn’t well addressed in a way that’s beginner friendly. Mr. Larson has talked about creating a set of secure APIs for student use, but I believe the local weather project is on the chopping block for the upcoming curriculum refresh.

I stand by my advice (though I haven’t gotten into trying to update the challenge instructions as I said in that thread I would).

I’m going to have to swallow my words here. After I had typed my last reply I went into codepen and tried to use geolocator and it worked. I then looked at AbdiViklas’ post (which I somehow did not find when doing the project, really wish I had. Would have made life a lot easier) and it made sense. When doing my project initially I must have been stuck in http instead of https://. I agree they at least need to update the info on these pages so that campers aren’t chasing their tails trying to get this challenge solved. At the bare minimum AbidVikas’ post should be referenced on the challenges page. I will go back and edit my initial post.

And subsequent posts in that thread by people that used Weather Underground successfully.