v157 · privacy · gpc

Read the signal both ways

GPC is one preference with two read surfaces. Scripts read navigator.globalPrivacyControl — a readonly boolean pinned to the value at navigation time (gpcAtNavigation) — and servers read the Sec-GPC: 1 request header, which carries the current preference on every request. This page reads both for real, adds the worker scope (WorkerNavigator includes the same mixin), and checks they agree.

Chrome ships the user setting in Chrome 157 (Settings → Privacy and security). To exercise the signal on an earlier or unflagged build: launch with --enable-blink-features=GlobalPrivacyControlForce to force the signal on (it implies the API), or --enable-blink-features=GlobalPrivacyControlApi for the JS surface alone, or flip chrome://flags/#enable-experimental-web-platform-features and relaunch. Firefox has shipped GPC since 120, so this page also works there.

1 · The DOM property (window scope)

'globalPrivacyControl' in navigator
…
navigator.globalPrivacyControl
…
property descriptor
…

Reading…

2 · Worker scope

The spec puts the mixin on WorkerNavigator too, so background work can respect the preference without a round-trip to the page. The button spawns a real dedicated worker and reads its navigator.globalPrivacyControl.

3 · The request header, echoed by the server

Nothing simulated: this fetch goes to a same-origin route that reports exactly what arrived. Per the spec's ABNF the only valid field value is "1", and a browser with the preference off must not send the header at all — so "absent" is a meaningful answer, not a failure.

Sec-GPC received
not fetched yet
exact value
—

Run the echo to compare header vs DOM.

code path

// Script-side: pinned to the value at navigation time (gpcAtNavigation).
const optedOut = navigator.globalPrivacyControl === true;

// Server-side (Deno): the live preference rides on every request.
const secGpc = request.headers.get("sec-gpc"); // "1" or null — never "0"

// Worker scope: WorkerNavigator includes GlobalPrivacyControl too.
// worker.js:  postMessage(navigator.globalPrivacyControl);

see also