Location permission not triggered on page load without user action
Why it matters
Triggering a geolocation permission prompt on page load — before any user interaction — violates GDPR Art. 5(1)(b) (purpose limitation and data minimisation) and ePrivacy Art. 5(3), which require that access to device capabilities be tied to a specific, user-initiated purpose. Browsers increasingly penalize automatic permission requests by pre-denying them, meaning an auto-triggered geolocation call trains the browser to block your site permanently. Beyond compliance, an unexpected permission dialog on load is a hostile UX pattern that signals your site does not respect user agency — a trust-damaging first impression for a directory product that depends on repeat engagement.
Severity rationale
Medium because unsolicited geolocation requests violate GDPR and ePrivacy requirements and cause browsers to pre-block your site's location access, degrading the feature for all future visits.
Remediation
Remove any navigator.geolocation call from component mount effects and ensure the call is made exclusively in response to an explicit user action such as a button click.
// WRONG — fires on mount, before any interaction
useEffect(() => {
navigator.geolocation.getCurrentPosition(handleLocation, handleError);
}, []);
// CORRECT — fires only on explicit user click
function MapComponent() {
const handleNearMe = () => {
navigator.geolocation.getCurrentPosition(handleLocation, handleError);
};
return <button onClick={handleNearMe}>Find Near Me</button>;
}
Search src/ for all navigator.geolocation call sites and confirm none appear inside useEffect with an empty dependency array or any top-level component body. Audit both the map component and any location-aware search components.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Map & Location Integration Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 5(1)(b) — Purpose Limitation — location data collected only on explicit user action, not on page load
- gdpr · Art. 9 — Special Categories — precise geolocation may constitute sensitive data requiring explicit consent
- eprivacy · Art. 5(3) — Storage of information — prior informed consent required before accessing device location
Taxons
History
- 2026-04-18·v1.0.0·Initial import from directory-map-location·automated