blob: 5c8e876be4da3b61c33a9846b563e1e0fb90739f (
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
90
91
92
93
94
95
96
97
98
99
100
101
|
---
title: 'CSP: media-src'
slug: Web/HTTP/Headers/Content-Security-Policy/media-src
tags:
- CSP
- Conten-Security-Policy
- Directive
- HTTP
- Media
- Reference
- Security
- Sécurité
- media-src
- source
translation_of: Web/HTTP/Headers/Content-Security-Policy/media-src
---
<div>{{HTTPSidebar}}</div>
<p>La directive HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) <code><strong>media-src</strong></code> spécifie les sources valides pour charger des médias en utilisant des éléments tels que {{HTMLElement("audio")}} et {{HTMLElement("video")}}.</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Version de CSP</th>
<td>1</td>
</tr>
<tr>
<th scope="row">Type de directive</th>
<td>{{Glossary("Fetch directive")}}</td>
</tr>
<tr>
<th scope="row">{{CSP("default-src")}} par défaut</th>
<td>Oui, si cette directive est absente, l'agent utilisateur consultera la directive <code>default-src</code></td>
</tr>
</tbody>
</table>
<h2 id="Syntaxe">Syntaxe</h2>
<p>Une ou plusieurs sources peuvent être autorisées pour cette directive :</p>
<pre class="syntaxbox notranslate">Content-Security-Policy: media-src <source>;
Content-Security-Policy: media-src <source> <source>;
</pre>
<h3 id="Sources">Sources</h3>
<p>{{page("fr/Web/HTTP/Headers/Content-Security-Policy/connect-src", "Sources")}}</p>
<h2 id="Exemples">Exemples</h2>
<h3 id="Cas_de_violation">Cas de violation</h3>
<p>Soit cet en-tête CSP :</p>
<pre class="brush: bash notranslate">Content-Security-Policy: media-src https://example.com/</pre>
<p>Ces éléments {{HTMLElement("audio")}}, {{HTMLElement("video")}} et {{HTMLElement("track")}} seront bloqués et ne se chargeront pas :</p>
<pre class="brush: html notranslate"><audio src="https://not-example.com/audio"></audio>
<video src="https://not-example.com/video">
<track kind="subtitles" src="https://not-example.com/subtitles">
</video></pre>
<h2 id="Spécifications">Spécifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
<th scope="col">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{specName("CSP 3.0", "#directive-media-src", "media-src")}}</td>
<td>{{Spec2('CSP 3.0')}}</td>
<td>Inchangé.</td>
</tr>
<tr>
<td>{{specName("CSP 1.1", "#directive-media-src", "media-src")}}</td>
<td>{{Spec2('CSP 1.1')}}</td>
<td>Définition initiale.</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</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.csp.Content-Security-Policy.media-src")}}</p>
<h2 id="Voir_aussi">Voir aussi</h2>
<ul>
<li>{{HTTPHeader("Content-Security-Policy")}}</li>
<li>{{HTMLElement("audio")}}, {{HTMLElement("video")}} and {{HTMLElement("track")}}</li>
</ul>
|