请求首部 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 AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 23Edge Full support YesFirefox Full support 4IE Full support 9Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

相关内容

文档标签和贡献者

此页面的贡献者: yenshen, WayneCui
最后编辑者: yenshen,