adding explicit existence checks for navigator.geolocation