JavaScript Navigator globalPrivacyControl Property

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Experimental

What You’ll Learn

navigator.globalPrivacyControl is a Boolean Global Privacy Control (GPC) signal for sell/share consent. Learn true vs false, the Sec-GPC header, how it differs from deprecated DNT, five examples, and try-it labs.

01

Kind

Read-only property

02

Returns

Boolean

03

Status

Experimental

04

true

Do not sell/share

05

false

Consent or unset

06

HTTP twin

Sec-GPC

Introduction

Privacy laws often talk about “do not sell” or “do not share” personal information. Global Privacy Control (GPC) is a browser signal that expresses that preference for the current website.

navigator.globalPrivacyControl is read-only. When the API exists, it returns a Boolean that mirrors the Sec-GPC HTTP header — so both your front end and your server can see the same preference.

💡
Not a full compliance framework

Reading GPC is one input. You still need a privacy policy, consent UI where required, and legal advice for your jurisdiction. GPC is a signal — not a complete solution by itself.

Understanding the globalPrivacyControl Property

Think of GPC as a site-scoped “please don’t sell or share my data” switch the user (or their browser/extension) can turn on.

  • true — user explicitly does not consent to sell/share with third parties.
  • false — user grants consent or has not indicated a preference (MDN).
  • Missing property — browser does not support GPC in JS — feature-detect.
  • Sec-GPC — the matching HTTP header for server-side handling.

📝 Syntax

General form of the property:

JavaScript
navigator.globalPrivacyControl

Value

  • A Boolean: true or false when the property is supported.

Common patterns

JavaScript
// MDN-style log:
console.log(navigator.globalPrivacyControl);
// true if the user opted out of sell/share; otherwise false (when supported)

// Safe feature-detect:
if ("globalPrivacyControl" in navigator) {
  if (navigator.globalPrivacyControl === true) {
    // Disable sell/share integrations for this visit
  }
} else {
  // Fall back to your consent banner / legal defaults
}

⚡ Quick Reference

GoalCode
Read GPCnavigator.globalPrivacyControl
Detect API"globalPrivacyControl" in navigator
Opt-out of sell/share?navigator.globalPrivacyControl === true
Type checktypeof navigator.globalPrivacyControl === "boolean"
HTTP twinSec-GPC request header
Status (MDN)Experimental / not Baseline

🔍 At a Glance

Four facts to remember about navigator.globalPrivacyControl.

Returns
boolean

true / false

Status
experimental

Not Baseline

true means
no sell/share

Explicit opt-out

Header
Sec-GPC

Same preference

📋 GPC vs doNotTrack

globalPrivacyControldoNotTrack
MeaningDo not sell/share personal infoOld “don’t track me” ask
TypeBoolean"1" / "0" / null
MDN statusExperimentalDeprecated + Non-standard
HTTPSec-GPCDNT
New appsPrefer (when supported)Avoid

Examples Gallery

Examples follow MDN Global Privacy Control / navigator.globalPrivacyControl patterns. Prefer Try It Yourself to inspect your browser. Use View Output for expected messaging.

📚 Getting Started

Detect the API and read the Boolean.

Example 1 — Feature Detection

Check whether GPC is exposed on navigator.

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

How It Works

If missing, fall back to your normal consent banner and legal defaults.

Example 2 — Read the Boolean

MDN-style log of the current GPC setting.

JavaScript
if (!("globalPrivacyControl" in navigator)) {
  console.log("unsupported");
} else {
  console.log(navigator.globalPrivacyControl);
}
Try It Yourself

How It Works

When supported, you get a real Boolean — not the strings "true" / "false".

📈 Practical Patterns

Labels, sell/share gating, and a structured helper.

Example 3 — Human-Readable Label

Translate the Boolean into a short status line for a privacy debug panel.

JavaScript
function gpcLabel() {
  if (!("globalPrivacyControl" in navigator)) {
    return "GPC: unsupported";
  }
  return navigator.globalPrivacyControl
    ? "GPC: do not sell/share"
    : "GPC: consent or no preference";
}

console.log(gpcLabel());
Try It Yourself

How It Works

Remember MDN: false covers both “granted consent” and “no preference indicated.”

Example 4 — Gate Third-Party Sharing

Skip a fictional “share with partners” path when GPC is true.

JavaScript
function mayShareWithPartners() {
  if ("globalPrivacyControl" in navigator &&
      navigator.globalPrivacyControl === true) {
    return false;
  }
  // Otherwise use your consent banner / defaults
  return true; // demo default — replace with real consent state
}

console.log("may share?: " + mayShareWithPartners());
Try It Yourself

How It Works

When GPC is unsupported, do not invent an opt-out — use your existing consent flow.

Example 5 — Structured Privacy Helper

Combine GPC with a deprecated DNT read for migration dashboards only.

JavaScript
function privacySignals() {
  return {
    globalPrivacyControl:
      "globalPrivacyControl" in navigator
        ? navigator.globalPrivacyControl
        : "unsupported",
    doNotTrack: navigator.doNotTrack, // deprecated — diagnostic only
    advice:
      "Prefer GPC when present; do not build new logic on DNT"
  };
}

console.log(JSON.stringify(privacySignals()));
Try It Yourself

How It Works

Use this when auditing old DNT code paths while adopting GPC.

🚀 Common Use Cases

  • Disable ad / data brokers — when GPC is true, skip sell/share tags.
  • Consent UI — pre-set “do not sell” toggles from the signal.
  • Server + client — honor Sec-GPC and the JS property together.
  • Migration from DNT — replace deprecated doNotTrack branches.
  • Privacy dashboards — show users what signal their browser sends.

🧠 How navigator.globalPrivacyControl Works

1

User enables GPC

Browser setting or extension sends the preference.

Preference
2

Exposed as Boolean + header

navigator.globalPrivacyControl and Sec-GPC.

Signal
3

Your site feature-detects

Read true to restrict sell/share behavior.

Honor
4

Combine with consent & law

GPC is one input alongside banners, CMP tools, and legal requirements.

📝 Notes

  • Experimental and not Baseline — support is limited.
  • Not Deprecated or Non-standard on MDN (unlike doNotTrack).
  • true = explicit do-not-sell/share; false = consent or no preference.
  • Mirrors the Sec-GPC HTTP header.
  • Related: doNotTrack, gpu, JavaScript hub.

Limited Browser Support

navigator.globalPrivacyControl is Experimental and not Baseline. Availability varies by browser and extension. Always feature-detect and keep a consent fallback.

Experimental · Not Baseline

Navigator.globalPrivacyControl

When true, treat sell/share as opted out for this site. When missing, use your normal privacy/consent flow.

Limited Not Baseline
Google Chrome Limited / evolving — check current GPC support
Limited
Microsoft Edge Limited — check current Sec-GPC / GPC status
Limited
Opera Limited — check current compat
Limited
Mozilla Firefox May expose via settings/extensions — verify on target versions
Limited
Apple Safari Check current WebKit / Safari GPC status
Limited
globalPrivacyControl Limited

Bottom line: Detect GPC, honor true as do-not-sell/share, and never rely on deprecated doNotTrack for new logic.

Conclusion

navigator.globalPrivacyControl is the JS face of Global Privacy Control. Feature-detect it, treat true as do-not-sell/share, pair it with Sec-GPC on the server, and prefer it over deprecated doNotTrack.

Continue with gpu, doNotTrack, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect before reading GPC
  • Honor true as do-not-sell/share
  • Check Sec-GPC on the server too
  • Keep a consent fallback when unsupported
  • Prefer GPC over deprecated DNT

❌ Don’t

  • Assume every browser exposes GPC
  • Treat false as “user loves ads”
  • Ignore applicable privacy laws
  • Build new privacy gates on doNotTrack
  • Skip documenting how you honor GPC

Key Takeaways

Knowledge Unlocked

Five things to remember about globalPrivacyControl

Experimental GPC Boolean — do not sell/share when true.

5
Core concepts
🚫 02

true

No sell/share

Opt-out
📄 03

false

Consent or unset

MDN
📡 04

Header

Sec-GPC

HTTP
🔬 05

Status

Experimental

Detect

❓ Frequently Asked Questions

It is a read-only Navigator property that returns a Boolean for the user’s Global Privacy Control (GPC) setting on the current site — whether they consent to selling or sharing personal information with third parties.
Yes. MDN marks it Experimental and not Baseline. Support is limited — 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 deprecated/non-standard and was a weak cooperative “don’t track” signal. GPC is a modern “do not sell/share” preference aimed at privacy laws and site obligations — still experimental in browsers, but the intended successor mindset for DNT.
No. It is read-only. Users enable GPC in supporting browsers or extensions; your page only reads the Boolean.
Did you know?

MDN’s example comment talks about the preference in plain English, but the value itself is a real Boolean true/false — not the strings "true" / "false".

Explore gpu Next

Learn the WebGPU entry point for graphics and GPU compute.

gpu →

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.

8 people found this page helpful