blob: 27365cada8f16464b3989c872a4bb2f4980a54e5 (
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
89
|
---
title: 'CSP: prefetch-src'
slug: Web/HTTP/Headers/Content-Security-Policy/prefetch-src
tags:
- CSP
- Content Security Policy
- Directive
- HTTP
- Reference
- prefetch-src
- コンテンツセキュリティポリシー
- ディレクティブ
translation_of: Web/HTTP/Headers/Content-Security-Policy/prefetch-src
---
<div>{{HTTPSidebar}}</div>
<p>HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における <code><strong>prefetch-src</strong></code> ディレクティブは、事前読み込みまたは事前描画することができる有効なリソースを指定します。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">CSP バージョン</th>
<td>3</td>
</tr>
<tr>
<th scope="row">ディレクティブ種別</th>
<td>{{Glossary("Fetch directive", "フェッチディレクティブ")}}</td>
</tr>
<tr>
<th scope="row">{{CSP("default-src")}} fallback</th>
<td>あり。このディレクティブがない場合、ユーザーエージェントは <code>default-src</code> ディレクティブを探します。</td>
</tr>
</tbody>
</table>
<h2 id="Syntax" name="Syntax">構文</h2>
<p><code>prefetch-src</code> ポリシーには、1つ以上のソースが許可されています。</p>
<pre class="syntaxbox">Content-Security-Policy: prefetch-src <source>;
Content-Security-Policy: prefetch-src <source> <source>;
</pre>
<h3 id="Sources" name="Sources">ソース</h3>
<p>{{page("/ja/docs/Web/HTTP/Headers/Content-Security-Policy/default-src", "common_sources")}}</p>
<h2 id="Example" name="Example">例</h2>
<h3 id="Prefetch_resources_do_not_match_header" name="Prefetch_resources_do_not_match_header">ヘッダーが一致しないリソースの事前読み込み</h3>
<p>次のコンテンツセキュリティポリシーを持つページがあったとします。</p>
<pre>Content-Security-Policy: prefetch-src https://example.com/
</pre>
<p>次のコードで読み込もうとすると、指定された URL が <code>prefetch-src</code> のソース一覧にないので、ネットワークエラーになります。</p>
<pre><link rel="prefetch" src="https://example.org/"></link>
<link rel="prerender" src="https://example.org/"></link></pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
<th scope="col">状態</th>
<th scope="col">備考</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{specName("CSP 3.0", "#prefetch-src", "prefetch-src")}}</td>
<td>{{Spec2("CSP 3.0")}}</td>
<td>初回定義</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat("http.headers.csp.Content-Security-Policy.prefetch-src")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{HTTPHeader("Content-Security-Policy")}}</li>
</ul>
|