v157 · approximate geolocation
Accuracy mode probe
Ask for the same position twice — once precise, once approximate — and compare what the browser returns. The support probe below answers a question the returned coordinates cannot: did Chrome actually read the accuracyMode member, or silently drop it?
Is accuracyMode read by this browser?
How this works: PositionOptions is a dictionary, so the browser reads its members off the object you pass. Defining accuracyMode as a getter reveals whether the implementation looks for it. A browser that has not shipped the option never calls the getter. No permission prompt is needed to find out.
Not run yet.
Compare the two modes
This asks for your real location. Chrome will prompt for permission. Nothing is uploaded — the coordinates stay in this page, and you can round them off with the control below before they are displayed.
| accuracyMode | latitude | longitude | accuracy (m) | time to fix |
|---|---|---|---|---|
| No fixes yet. | ||||
code path
// Did the browser read the member at all?
let read = false;
navigator.geolocation.getCurrentPosition(onFix, onError, {
get accuracyMode() { read = true; return "approximate"; },
timeout: 10000,
});
// The fix itself. `accuracy` is the radius in metres of a circle the
// browser is roughly 68% confident contains the user.
function onFix(position) {
console.log("[approx-geo] accuracy radius", position.coords.accuracy, "m");
}