v157 · capabilities (fugu) · privacy

Approximate geolocation

Chrome 157 adds an accuracyMode option to PositionOptions. Passing "approximate" to getCurrentPosition() or watchPosition() tells the browser you only need a coarse fix — enough for a weather panel, a currency, or a nearest-store list — so the user can share their region without handing over a doorstep-accurate coordinate.

concepts

  1. Accuracy mode probe

    Call the real navigator.geolocation.getCurrentPosition() in both modes and compare what comes back: coordinates, the reported accuracy radius in metres, and how long the fix took. Includes a support probe that can tell "the option was honoured" from "the option was ignored".

  2. Accuracy radius visualiser

    Draw the returned accuracy radius to scale against familiar distances — a building, a block, a neighbourhood, a city. Plot your own live fix, or drag the radius to see how much ground a given accuracy covers.

  3. Store locator that asks for less

    A working nearest-branch finder over a fixed store list. Run it on a precise fix and on an approximate one and watch the ranking: for a city-scale lookup, the coarse fix picks the same branch, which is the argument for requesting less.

  4. Watch, switch, and revoke

    The edge cases: watchPosition() with an accuracy mode, switching mode mid-watch, reading live permission state from the Permissions API, and the failure branches — denied, timed out, unavailable, and an accuracyMode the browser silently drops.

  5. Precision budget

    Pick what you are actually building — timezone, weather, store list, delivery ETA, turn-by-turn — and see the coarsest radius that still works, which mode to request, and what breaks if you ask for precision you do not need.

why it shipped

Most sites that call the Geolocation API do not need metre-level precision. A weather panel needs a city, a shipping estimator needs a region, a store locator needs somewhere within a few kilometres. Until now the API had one setting — enableHighAccuracy — and turning it off was a hint about power and speed, not a promise about precision: the browser could still return an exact fix.

accuracyMode: "approximate" makes the request itself coarse. The site says what it needs, the user agent can present that in the permission prompt, and the site gets a position it cannot use to identify a household. The privacy improvement costs the site nothing when a coarse fix was always enough.

the API

navigator.geolocation.getCurrentPosition(
  (position) => {
    // position.coords.accuracy is the radius, in metres, of a circle
    // the browser is ~68% confident the user is inside.
    console.log(position.coords.latitude, position.coords.accuracy);
  },
  (error) => console.warn(error.code, error.message),
  { accuracyMode: "approximate", maximumAge: 600000, timeout: 10000 },
);

accuracyMode is "precise" by default, so existing calls are unchanged. A browser that has not shipped the option ignores it — the dictionary member is simply dropped — which is why the demos here compare the returned accuracy across modes rather than trusting that the option was read.

references