# Console: User denied Geolocation / Only secure origins are allowed (geolocation) / GeolocationPositionError code 1

**Code:** `Geolocation permission denied` · **Category:** Browser · **Seen on:** Chrome, Firefox, Safari, JavaScript

`navigator.geolocation` failed because the user blocked location, the page is not on HTTPS, or the OS has location services off.

## Meaning

The error object has a `code`: 1 PERMISSION_DENIED, 2 POSITION_UNAVAILABLE, 3 TIMEOUT. Chrome and others require a secure context for geolocation. Permission is remembered per site, so a past "Block" keeps failing until reset.

## Common causes

- User clicked Block (saved for the site)
- Page served over HTTP, or an iframe without `allow="geolocation"`
- OS location services disabled for the browser
- Position unavailable indoors / no GPS or Wi-Fi data (code 2)
- Timeout too short (code 3)

## Quick fix

1. Serve the page over HTTPS and ask after a user action
2. Reset the site permission (lock icon → Site settings → Location)
3. Enable system location services for the browser

## Detailed fix by platform

### JavaScript

1. `navigator.geolocation.getCurrentPosition(ok, err => console.log(err.code, err.message), { enableHighAccuracy: false, timeout: 10000 })`

### Windows

1. Settings → Privacy & security → Location → on, and allow desktop apps

### macOS

1. System Settings → Privacy & Security → Location Services → browser on

## How to diagnose

1. **Code** — GeolocationPositionError code 1, 2 or 3?
2. **Context** — HTTPS?
3. **OS** — Location services on?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/browser/geolocation-permission-denied-or-insecure)
