"Show the Local Weather" App

"Show the Local Weather" App
0.0 0

#1

Project Link - https://codepen.io/Audiosyncrasy/full/aYQjEr/

This project has been a great exercise for stretching my coding knowledge. I have the app mostly finished, but I’m having trouble with the HTML geolocation API call.

When it first makes the geolocation API call, it either locates the user somewhere in Japan or returns an error. I tweaked my code so that when I call navigator.geolocation.getCurrentPosition(success, error, options); the options parameter is set to: enableHighAccuracy = true.

I can sometimes get the app to play nicely if I refresh the page a few times.

I’m at a loss regarding why the geolocation call is being so finicky. Should I avoid loading the function based on the window.onload event, or is there something else going on?


#2

it’s a common bug with geolocation taking a while to call after subsequent calls.

Shuzenji is the cached result from the API. it’s an open issue in FCC github


#3

Thanks for the reply! Is there a workaround for it?