3/ π¨ Achtung! π¨ - location is private information π΅οΈ, the user has to actively give permission for the browser to receive this info.
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
Top-level
3/ π¨ Achtung! π¨ - location is private information π΅οΈ, the user has to actively give permission for the browser to receive this info. https://developer.mozilla.org/en-US/docs/Web/API/Geolocation 7 comments
5/ Assuming the user gives permission π, the browser then receives a longitude and latitude, and potentially other info like altitude. Important: depending on the tech used these coords may be more or less accurate ππ The accuracy value is a number in meters that the actual position may vary from the reported position. https://developer.mozilla.org/en-US/docs/Web/API/GeolocationCoordinates Note: browsers also allow users to turn off location prompting. 6/ ok, so now we have geographic coordinates! We use them as inputs into reverse geocoding, which is turning coordinates into location human-readable location info. You may recall our #geoeducation thread about the nuances of reverse geocoding https://en.osm.town/@opencage/111743653275940467 7/ We have a guide to this whole process of browser geolocation to geocoding with example javascript (where the code screenshots above came from) https://opencagedata.com/guides/how-to-determine-user-location-via-browser-geolocation 8/ Want to see browser geolocation in action? Give it a go on this OpenLayers tutorial: But make sure you haven't disabled geolocation in your browser settings. Some browsers helpfully show this in the nav bar. Please note also that if browser location relies on IP geolocation it can be misled by VPNs. 9/ Wrapping up - browser location is an interesting tool that can be used to improve the user's web application experience. But ... it requires user permission, and even if that permission is granted it can be inaccurate or misleading. π©βπ Want to learn more? Here's the official W3C geolocation spec: https://w3c.github.io/geolocation-api/ |
4/ How exactly the browser determines the location varies.
It may be from GPS π°οΈ or cell towers πΌ(on mobile) or wifi πΆ or IP-to-location. each of these methods have pros and cons.
Developers can ask the browser for a more or less accurate location.
Here's what that looks like in basic javascript:
#geoeducation