blob: 02ca69c78a2e9c883180e63878764ab5e78c308d (
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
|
---
title: Timing-Allow-Origin
slug: Web/HTTP/Headers/Timing-Allow-Origin
translation_of: Web/HTTP/Headers/Timing-Allow-Origin
---
<div>{{HTTPSidebar}}</div>
<p>响应头<code><strong>Timing-Allow-Origin</strong></code>用于指定特定站点,以允许其访问<a href="/en-US/docs/Web/API/Resource_Timing_API">Resource Timing API</a>提供的相关信息,否则这些信息会由于跨源限制将被报告为零</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Header type</th>
<td>{{Glossary("Response header")}}</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name")}}</th>
<td>no</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">Timing-Allow-Origin: *
Timing-Allow-Origin: <origin>[, <origin>]*
</pre>
<h2 id="指令">指令</h2>
<dl>
<dt>*</dt>
<dd>服务器可以以“<code>*</code>”作为通配符,从而允许所有域都具有访问定时信息的权限。</dd>
<dt><origin></dt>
<dd>指定一个可以访问资源的URI。你也可以通过逗号隔开,指定多个URI。</dd>
</dl>
<h2 id="示例">示例</h2>
<p>如需允许任何资源都可以看到的计时(timing)信息,你可以如此设置:</p>
<pre>Timing-Allow-Origin: *
</pre>
<p>如需允许<code>https://developer.mozilla.org</code>查看你的计时信息,你可以设置:</p>
<pre>Timing-Allow-Origin: https://developer.mozilla.org</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('Resource Timing 3', '#timing-allow-origin', 'Timing-Allow-Origin')}}</td>
<td>{{Spec2("Resource Timing 3")}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("http.headers.Timing-Allow-Origin")}}</p>
<h2 id="参见">参见</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Resource_Timing_API">Resource Timing API</a></li>
<li><a href="/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API">Using the Resource Timing API</a></li>
<li>{{HTTPHeader("Vary")}}</li>
</ul>
|