I had the same issue with Chrome on Windows, but I got it at least for a while.
I also used the example http://html5demos.com/geo
The place was not just inaccurate, but also in the wrong city.
I tried the same example on my iPad (Safari), and that was right there. My iPad uses the same WiFi network as my computer, so I knew then that this was not a problem with my provider returning the wrong location, this is due to the browser on my PC.
I got it to show the correct location in Chrome by going to Chrome settings and clearing the cache and cookies.
It’s not enough just to select “Tools / Clear browsing data / cookies and cache” in Chrome, this only happened after I selected “Settings / Privacy / Content settings / All cookies and site data” in Chrome and deleting all cookies whether the example showed an example of the correct location.
Update 1: the next day I tried the same geolocation example, and to my annoyance, it again showed the wrong city. I tried to get it working by clearing the Chrome settings as described above, and this time this solution did not work. However, when I used the CCleaner app and the selected Cleaner / Applications and cleared all the Chrome data (internet cache, internet history, cookies and session), the geo example showed the correct location. I am using the latest version of Chrome. Let's hope that in future versions it will work more consistently.
Update 2: I tried the above procedure later and could not get it to create the correct location at all. Maybe geolocation is now returning the location of my internet service provider, rather than my location, using my IP address and Google geolocation services. Of course, this place is useless. The reason my iPad returns the correct location is probably because it contains built-in GPS. The iPad 3G / 4G has a GPS chip built into the GSM receiver chip, while WiFi models only don't have GPS. When "location services" are turned off in your iPad’s settings, your location using GPS and IP is turned off. It would be useful to simply disable GPS on my iPad and just use the IP address, but I'm not sure if this is possible.
Update 3. As I mentioned, I use a WiFi stick on my PC. I noticed that when I look at the available Wi-Fi networks (using View Available Wireless Networks), and mine is the only network, the geolocation example returns a location in another city, but if one of my neighbors has a WiFi network in the range my computer, an example of geolocation returns my exact location within a few meters. that is, the geolocation in the browser is smart enough to use this additional information to search for me.
(I think the other answer to this question entirely concerns the wrong path. The questionnaire indicates that the location was shown in the wrong city, so the question is not related to the accuracy of the location)