Navigator:globalPrivacyControl 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

Navigator.globalPrivacyControl 只读属性返回用户对当前网站的全球隐私控制设置。此设置指示用户是否同意网站或服务将其个人信息出售或共享给第三方。

该属性的值反映了 Sec-GPC HTTP 标头中的值。

如果用户明确表示不同意出售或共享其数据,则为 true;如果用户同意出售或共享数据,或者尚未表明偏好,则为 false

示例

js
console.log(navigator.globalPrivacyControl);
// 如果用户明确表示不同意共享或出售其数据,则为“true”;否则为“false”。

规范

Specification
Global Privacy Control (GPC)
# dom-globalprivacycontrol-globalprivacycontrol

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
globalPrivacyControl
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

参见