I also put this message in an issue thread on Github. I’m not sure who has the power to edit the official FCC project, or how to get their attention, but here I am to say that we, as a community, really need to fix it ASAP. As it stands, the syllabus first teaches you about navigator.geolocation, then drops you into this project with the comment, “We recommend using the Open Weather API.” The student is left to bang their head over the problem before finding that the two can’t work together, and it seems a bit silly to set them up for failure and then wait for them to find the answer here, or on Github, or on Gitter (where everyone else gets tired of explaining it several hundred times per day).
Just to be clear, the problem is:
-
navigator.geolocation
only works over https - openweather.org doesn’t (for free)
Many suggest, and even the example pen shows, getting location by IP. I feel like this is not best practice, especially in a mobile-first age, because of these kinds of issues.
There is a solution that is functional and (comparitively) elegant.
- Add
https
to your codepen URL. Make sure you share the URL that way, and maybe put an error alert in prompting the user to do so in case anybody gets hold of an http version - Use
navigator.geolocation
- Use Forecast.io. They work over https, they’re free, and–best part–they have a matching set of gorgeous, animated icons!
As far as I know, this issue and its solutions have been known for over a month. Meanwhile, dozens of campers per day plow into it. I move that the wording of the page be changed IMMEDIATELY, at least to make people aware of the problem. I also move that a note be added to the geolocation checkpoint to mention that it won’t work, in Chrome, without https.