JavaScript Navigator globalPrivacyControl Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.globalPrivacyControl is a read-only Boolean that returns the user’s Global Privacy Control (GPC) preference (MDN). It mirrors the Sec-GPC HTTP header.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.globalPrivacyControl. Start with this line.

JavaScript
navigator.globalPrivacyControl
CallWhat it does
navigator.globalPrivacyControlPrimary signature.

Built into the browser. Read navigator.globalPrivacyControl on Navigator — no import required.

Library declarations
JavaScript
navigator.globalPrivacyControl

Parameters

ParameterDescription
Feature detectRequired. Property may be missing

Return Value

Return ValueDescription
*true | false

JavaScript Examples

Example 1 — Feature-Detect

Check whether globalPrivacyControl exists before reading it.

JavaScript
const supported = "globalPrivacyControl" in navigator;
console.log(supported ? "GPC available" : "GPC missing");
Try It Yourself

How It Works

  1. Use in. Tests for the property without reading a value.
  2. Expect limited support. Firefox often has it; Chrome/Safari may not.
  3. Log clearly. Students see support without throwing.
  4. Keep a fallback. Missing GPC → normal consent flow.

Example 2 — Read the Boolean

MDN-style log of the current GPC preference.

JavaScript
if (!("globalPrivacyControl" in navigator)) {
  console.log("unsupported");
} else {
  console.log(navigator.globalPrivacyControl);
  // true if user does not want data sold/shared; otherwise false
}
Try It Yourself

How It Works

  1. Detect first. Avoid reading a missing property.
  2. Log the Boolean. MDN: true or false.
  3. Interpret carefully. false can mean unset, not “sold.”
  4. Mirror HTTP. Same idea as the Sec-GPC header.

Example 3 — Respect a GPC Signal

Branch privacy behavior when the user opts out of sell/share.

JavaScript
function shouldLimitSharing() {
  if (!("globalPrivacyControl" in navigator)) return false;
  return navigator.globalPrivacyControl === true;
}

console.log(
  shouldLimitSharing()
    ? "honor do-not-sell/share"
    : "no GPC opt-out signal"
);
Try It Yourself

How It Works

  1. Detect the API. Return false when unsupported.
  2. Require strict true. Only then treat as an opt-out.
  3. Act on the signal. Limit sale/share of personal data.
  4. Combine with policy. GPC is a preference signal — follow applicable law too.

Browser Support

Navigator.globalPrivacyControl is Experimental and Limited availability (not Baseline) on MDN. It reflects the same preference as the Sec-GPC header.

✓ Experimental · Not Baseline

Navigator.globalPrivacyControl

Native support is strongest in Firefox 120+ (and Firefox for Android 122+). Chrome, Edge, and Safari typically omit the property. Always feature-detect.

Limited Not Baseline
Mozilla Firefox 120+ · Desktop; 122+ Android
Supported
Google Chrome Not typically available
Unavailable
Microsoft Edge Not typically available
Unavailable
Apple Safari Not typically available
Unavailable
Opera Chromium-based — usually missing
Unavailable
navigator.globalPrivacyControl Limited

Bottom line: Detect GPC, honor true as do-not-sell/share, and keep a solid consent fallback when the API is missing.

Frequently Asked Questions

It is a read-only Navigator property that returns a Boolean for the user’s Global Privacy Control (GPC) setting — whether they consent to selling or sharing personal information with third parties (MDN).
Yes. MDN marks it Experimental and Limited availability (not Baseline). Always feature-detect before reading it.
MDN: true means the user explicitly does not consent to sell or share their data. false means they either grant consent or have not indicated a preference.
The property reflects the same preference as the Sec-GPC HTTP header, so servers and client scripts can see a consistent signal.
doNotTrack is a discontinued/non-standard “don’t track” signal. GPC is a modern “do not sell/share” preference intended to work with privacy laws. Prefer GPC for new work.
No. It is read-only. Users enable GPC in supporting browsers or extensions; your page only reads the Boolean.

Next: gpu

Learn the navigator.gpu entry point for WebGPU.

gpu tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful