Skip to main content

How to fix: Geolocation API Referenced

The page references navigator.geolocation. This check only detects the API reference; it does not verify whether the call is gated behind an explicit user action (e.g. a "Use my location" button) or fires automatically on page load.

Why it matters

If genuinely ungated, automatically prompting for location permission on page load is poor UX and may violate GDPR/CCPA. Manually confirm the call site before treating this as a consent issue.

Geolocation should only be requested when the user initiates an action that clearly requires it.

How to fix it

  1. 1Request geolocation only in response to an explicit user action (e.g., "Use my location" button)
  2. 2Explain why location is needed before requesting permission
  3. 3Do not store precise geolocation data without explicit consent

Code examples

Request geolocation only when needed

JavaScript
// Only request geolocation on explicit user gesture
document.querySelector('#find-me').addEventListener('click', () => {
  navigator.geolocation.getCurrentPosition(
    (pos) => handleLocation(pos),
    (err) => console.warn('Geolocation denied:', err),
    { maximumAge: 60000, timeout: 5000 }
  );
});

References

Detected automatically by VulnRadar. The check id is geolocation-usage, stable across every scan so you can filter or diff on it.

See every content check

Questions

How severe is Geolocation API Referenced?
VulnRadar rates this low severity in the content category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id geolocation-usage, which stays the same between runs so you can filter, diff, or gate CI on it.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for geolocation api referenced

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Geolocation API Referenced | VulnRadar