HTML Geolocation

All HTML topics
∙ Chapter 72

HTML Geolocation

Geolocation is a browser API (JavaScript). It requires user permission and usually works only on HTTPS.

📍JS example
navigator.geolocation.getCurrentPosition(  (pos) => console.log(pos.coords.latitude, pos.coords.longitude),  (err) => console.error(err));
⚠️Never request location unless you truly need it. Explain why you need it.