# Geolocation API 🗺
TIP
The Geolocation API allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information.
# Examples
WARNING
🔒 This feature is available only in secure contexts (HTTPS)
# Demo #1
Geolocation basics
Code
navigator.geolocation
.getCurrentPosition((position) => {
console.log(position)
}, (error) => {
console.log(error)
})
1
2
3
4
5
6
2
3
4
5
6