geolocation

The geolocation permission allows an extension to access the user's current geographical location without interrupting them with a prompt.

What it does

  • There is no chrome.geolocation API — the permission simply unlocks the standard Web navigator.geolocation APIs from extension contexts (popups, content scripts, options pages, offscreen documents).
  • Bypasses the usual per-origin runtime prompt that websites must show; the user consents once when installing the extension instead.
  • Service workers do not have navigator.geolocation. To call the API from a background context, create an offscreen document with reasons: ['GEOLOCATION'] and run the call there.

When to use it

Use this permission when your extension's core functionality depends on knowing the user's location.

Examples:

  • A weather extension that shows local forecasts.
  • A "nearby places" extension that finds restaurants or points of interest.
  • An extension that customizes content based on the user's country or region.

Manifest Declaration

This permission may trigger a warning on installation.

{
  "name": "My Local Weather Extension",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "geolocation"
  ]
}

Security & Privacy

Why is it risky?

GPS-grade coordinates are sensitive personal data: they can reveal a user's home address, workplace, daily routine, and travel history. An extension with this permission can call the geolocation API silently, without the per-page prompt that ordinary websites must show. Combined with network access, it can quietly upload location to a remote server.

The browser still surfaces a location-active indicator, and the user can revoke the permission per-extension from chrome://extensions, but the underlying capability is high-trust. Use it only when location is genuinely required for the extension's core feature.

API Usage Example

This example gets the user's current position and logs it. This code can be run in a service worker or a popup script.

// popup.js, options.js, content script, or an offscreen document
// (NOT a service worker — service workers don't have navigator.geolocation)

function logUserLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(
      (position) => {
        const { latitude, longitude } = position.coords;
        console.log(`User's location:`);
        console.log(`  Latitude: ${latitude}`);
        console.log(`  Longitude: ${longitude}`);
      },
      (error) => {
        console.error(`Error getting location: ${error.message}`);
      }
    );
  } else {
    console.log("Geolocation is not supported by this browser.");
  }
}

logUserLocation();

Extensions with the geolocation permission

Here are some popular browser extensions that use the "geolocation" permission. To explore more, try our Advanced search.

References


Related Permissions

  • This is a standalone permission with no direct relatives.

Permission Metrics

Popularity

Security Risk


Usage by Platform