Decided to try out this geolocation code from W3 Collective. It uses Leaflet instead of Google Maps so I don’t need a Google API code. Note that if you are using a VPN, it may not accurately show your location.
Since this can compromise privacy, the position is not available unless the user approves it.