Your geographic location is obtained through various means such as using wifi data, Java etc and is often highly accurate.
Websites can ask the browser for your location using javascript. When they do so, the browser first asks your permission, and if you accept, it detects your location (typically by transmitting a list of available wifi access points to a geolocation provider such as Google Location Services) and gives it to the website.
Most modern browsers implement the geolocation API as defined by the W3C which enables browsers to detect the geographic location of the device. This enables web services which rely on location information to function correctly. The specification doesn’t define the location sources but the following are commonly used:
Global Positioning System (GPS)
Available WiFi networks and signal strengths
GSM/CDMA cell IDs
IP address
If you are connected to VPN the IP address lookup should return the location of the VPN server. However if your browser is configured to use any of the alternate location sources then your actual location may be revealed to web services. Most commonly your WiFi network information will be used as there are large databases which map WIFI networks to a geographic location (usually created by cars with GPS & WIFI e.g. Google Street View cars).
How to disable geolocation in browsers?
Google Chrome
Click the Chrome menu button on the browser toolbar (with the 3 dots).
Click on Settings.
Scroll down and click on Advanced.
In the ‘Privacy and security’ section, click Site settings.
Click ‘Location’ and toggle ‘Ask before accessing’ to ‘Blocked’.