When using navigator.geolocation.getCurrentPosition it is considered best practice to run that function based on user-specific input. In fact, if you run
navigator.geolocation.getCurrentPosition