Example 1 — Example
Typical usage.
JavaScript
console.log(typeof navigator.geolocation);
console.log("geolocation.getCurrentPosition(success, error)");How It Works
- navigator.geolocation. Entry point.
- getCurrentPosition. One-shot read.
The Geolocation API reads the device location via navigator.geolocation (with permission).
console.log(typeof navigator.geolocation);
console.log("geolocation.getCurrentPosition(success, error)");Typical usage.
console.log(typeof navigator.geolocation);
console.log("geolocation.getCurrentPosition(success, error)");Check support.
console.log("Geolocation — verify browser/Node support");CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful