Geolocation
Asks the person for their device location, precise or approximate.
In one line
Can find where your device is, once or while the page is open
Asks the person for their device location, precise or approximate.
Tells the site where the person physically is, down to a few meters outdoors: home, workplace, travel, daily routine. Repeated fixes reveal patterns of life.
What it can and can't do
What the user does: You tap Use my location, Find stores near me or a map button, then choose Allow
It can
- Find your position, precise or approximate where the device lets you choose
- Check your position again while the page stays open
- Remember your answer if you choose Allow while visiting or Remember
It cannot
- Track you in the background while the page is closed
- Use your location after you pick Don't allow or after one time access ends
- Get a precise spot if you choose approximate on Android 12 or later
- Skip the prompt, which always asks first on a new site
How it differs between platforms: Chrome offers Allow this time. Android 12 and later lets you pick precise or approximate. Safari and Firefox offer Allow or Don't Allow with an optional remember.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 5 | 2010-05-25 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 3.5 | 2009-06-30 | None |
| Safari | Supported | 5 | 2010-06-07 | None |
| Safari on iPhone | Supported | 3 | 2009-06-17 | None |
| Chrome on Android | Supported | 18 | 2012-06-27 | Android 12+ lets the person choose Approximate (about 2 km square) or Precise |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | navigator.geolocation.getCurrentPosition(), watchPosition(), clearWatch(); options enableHighAccuracy, timeout, maximumAge |
| Permission name | geolocation |
| Permissions policy | geolocation |
| Browser compat keys | api.Geolocationapi.Geolocation.getCurrentPositionapi.Geolocation.watchPositionapi.GeolocationCoordinatesapi.GeolocationPositionError |
| How access is granted | prompt |
| What the user sees | Chrome: bubble with Allow while visiting, Allow this time (Chrome 116), Don't allow. Firefox: Allow or Block with optional Remember. Safari: Allow or Don't Allow. Android 12+: Precise or Approximate choice. OS Location Services must also be on. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Chrome and Edge: persistent per origin after Allow; Allow this time ends when the tab closes or is backgrounded. Firefox: permanent only if Remember is ticked. Safari: asks again per visit unless set to Allow. |
| How to take it back | Padlock and Site settings; Chrome Safety Check auto-resets unused permissions; PermissionStatus 'change' event; turning off OS Location Services blocks all sites. |
| Inside an iframe | Cross-origin iframes need allow="geolocation"; the decision is keyed to the top-level origin. |
Typical flow
- Call getCurrentPosition or watchPosition
- Browser checks Permissions Policy and secure context
- Browser shows prompt unless a decision is stored
- OS provider (GPS, Wi-Fi, cell, IP) returns a fix
- Success callback gets GeolocationPosition, or error callback gets code 1 PERMISSION_DENIED, 2 POSITION_UNAVAILABLE, 3 TIMEOUT
Data you get
What comes back: Coordinates with accuracy radius and optional speed and heading
Shape: object
How often: one-shot, or continuous via watchPosition (about 1 update per second on GPS)
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
latitude | float | degrees | -90 to 90 | about 5 m (GPS) to 5 km (IP fallback) |
longitude | float | degrees | -180 to 180 | same as latitude |
accuracy | float | meters | 0 to unbounded (68% confidence radius) | typical 5 to 20 m GPS, 20 to 100 m Wi-Fi, 1 to 5 km cell or IP |
altitude | float or null | meters | about -500 to 9000 | often null on desktop |
heading | float or null | degrees from true north | 0 to 360 | null when speed is 0 |
speed | float or null | meters per second | 0 to unbounded | 0.1 m/s |
maximumAge | option | ms | 0 (default) to Infinity | cached fix up to this age is accepted |
timeout | option | ms | 0 to Infinity (default Infinity) | prompt time does not count |
Technical limits
- No location without a visible prompt or a stored grant
- No background geolocation after the tab closes
- Mobile browsers pause or throttle updates in background tabs
- Desktop without GPS returns Wi-Fi or IP estimates (20 m to 5 km)
- Blocked in insecure contexts and in cross-origin iframes without allow
The story
What it is
A site asks where you physically are.
For you
A prompt says 'Allow this site to know your location?' You choose Allow once, Allow while using, or Block. If you allow, the site may see you within meters. It can also check again later.
For makers
Location powers maps, nearby results and delivery. It lets makers show local prices, stores and weather. It is also valuable for ads and for proving you are in an allowed place, such as a legal betting region.
Where you see it
| Type | Example | Apps |
|---|---|---|
| maps | A web map centers on your blue dot and gives directions from where you are. | Google Maps, Apple Maps web |
| delivery | A food site shows only restaurants that deliver to your spot. | DoorDash, Uber Eats |
| games | A location based web game or geocaching page shows treasures near you. | Geocaching.com |
| games | A betting or fantasy site checks that you are inside a state where play is legal before it lets you bet. | DraftKings, FanDuel |
| rideshare | A ride web page sets your pickup point to where you stand. | Uber, Lyft |
| shopping | A store site shows the nearest pickup store and stock. | Target, Home Depot |
| security | A bank may check that a login location fits your normal area. | None named |
| ads | An ad network uses repeated fixes to learn your home, work and routine. | None named |
Risks
- Reveals home and work
- Used for ad profiling
What the platform says
- MDN (standards docs): Geolocation API. Describes the permission that lets a site ask for your location, with a prompt you can allow or block.
- web.dev (Google): User location. Google teaches developers how to ask for and use a person's location on the web.
Good uses and abuse
Legitimate uses
- Store locator
- Delivery address autofill
- Ride hailing pickup
- Local weather and news
- Payment fraud checks
Known abuse
- Home and workplace inference from repeated fixes
- Selling movement data through ad SDKs
- Prompt spam on load to wear users down
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 5 of 5 | How revealing the data is |
| Utility | 5 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2016-04, Chrome 50: Geolocation restricted to secure contexts
- 2017-08, Firefox 55: Geolocation restricted to secure contexts
- 2020-09, Safari on iPhone 14: iOS 14 adds system Precise Location toggle that applies to Safari websites
- 2021-10, Chrome on Android Android 12: Approximate vs Precise choice added to the Android location dialog
- 2023-08, Chrome 116: One-time permission (Allow this time) added for geolocation, camera, microphone
- 2026-01, Chrome 144: Browser-drawn <geolocation> element ships as an alternative request path
Related capabilities
Related
- HTML <geolocation> element. Can show a browser made button that asks for your location when you tap it
- Geolocation in iframes. Can let an embedded map ask for your location, only if the host page allows
- Permissions API. Can check whether you allowed or blocked a feature, without asking you
Sources
How well checked: Based on official documentation.