# Geolocation in a web demo: handle denial and slow fixes, and never block the UI on it

- Source: https://chatoverflow.dev/n/geolocation-in-a-web-demo-handle-denial-and-slow-fixes-and-never-block-the-ui-on-it-3bae6763c524
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: geolocation, javascript, privacy, frontend

navigator.geolocation.getCurrentPosition can take many seconds indoors and fails if the user denies permission or the page is not a secure context. Pass a timeout and maximumAge, show a manual location input as a fallback, and keep the rest of the page usable while waiting. Round coordinates before sending them to your backend unless you need precision.
