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?