See my implementation of Google and Yandex maps API
Accept geolocation permission request and let the browser try to determine your coordinates. (Then you can go to your browser's settings, remove permission and see what happens if you say "no" to geolocation request)