DNT

请求首部 DNT (Do Not Track) 表明了用户对于网站追踪的偏好。它允许用户指定自己是否更注重个人隐私还是定制化内容。

Header type Request header
Forbidden header name yes

语法

DNT: 0
DNT: 1

指令

0
表示用户愿意目标站点追踪用户个人信息。
1
表示用户不愿意目标站点追踪用户个人信息。

示例

使用 JavaScript 读取 “不追踪” (Do Not Track)状态

用户对 DNT 的设置还可以使用 Navigator.doNotTrack 属性进行读取:

navigator.doNotTrack; // "0" or "1"

规范

Specification Status Comment
Tracking Preference Expression (DNT)
DNT Header Field for HTTP Requests
Candidate Recommendation Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
DNTChrome Full support 23Edge Full support YesFirefox Full support 4IE Full support 9Opera Full support YesSafari No support 6 — 12.1WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS No support ? — 12.2Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support

相关内容