blob: 7c639c766f4c4d18949b7235b7afbb61b81f7c80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
---
title: DNT
slug: Web/HTTP/Headers/DNT
tags:
- 不追踪
- 定制化内容
- 请求首部
- 隐私
translation_of: Web/HTTP/Headers/DNT
---
<div>{{HTTPSidebar}}</div>
<p>请求首部 <strong><code>DNT</code></strong> (<strong>D</strong>o <strong>N</strong>ot <strong>T</strong>rack) 表明了用户对于网站追踪的偏好。它允许用户指定自己是否更注重个人隐私还是定制化内容。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Header type</th>
<td>{{Glossary("Request header")}}</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name")}}</th>
<td>yes</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">DNT: 0
DNT: 1
</pre>
<h2 id="指令">指令</h2>
<dl>
<dt>0</dt>
<dd>表示用户愿意目标站点追踪用户个人信息。</dd>
<dt>1</dt>
<dd>表示用户不愿意目标站点追踪用户个人信息。</dd>
</dl>
<h2 id="示例">示例</h2>
<h3 id="使用_JavaScript_读取_“不追踪”_(Do_Not_Track)状态">使用 JavaScript 读取 “不追踪” (Do Not Track)状态</h3>
<p>用户对 DNT 的设置还可以使用 {{domxref("Navigator.doNotTrack")}} 属性进行读取:</p>
<pre class="brush: js">navigator.doNotTrack; // "0" or "1"</pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Tracking','#dnt-header-field', 'DNT Header Field for HTTP Requests')}}</td>
<td>{{Spec2("Tracking")}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
<p>{{Compat("http.headers.DNT")}}</p>
<h2 id="相关内容">相关内容</h2>
<ul>
<li>{{domxref("Navigator.doNotTrack")}}</li>
<li>{{HTTPHeader("Tk")}} header</li>
<li><a href="https://en.wikipedia.org/wiki/Do_Not_Track">Do Not Track on Wikipedia</a></li>
<li><a href="https://www.eff.org/deeplinks/2011/02/what-does-track-do-not-track-mean">"Do Not Track"中的"Track"指什么? – EFF</a></li>
<li><a href="http://donottrack.us/">donottrack.us</a></li>
<li>DNT 浏览器设置帮助:
<ul>
<li><a href="https://www.mozilla.org/en-US/firefox/dnt/">Firefox</a></li>
<li><a href="https://support.google.com/chrome/answer/2790761">Chrome</a></li>
</ul>
</li>
</ul>
|