aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/featurepolicy/allowsfeature
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/fr/web/api/featurepolicy/allowsfeature
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/fr/web/api/featurepolicy/allowsfeature')
-rw-r--r--files/fr/web/api/featurepolicy/allowsfeature/index.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/files/fr/web/api/featurepolicy/allowsfeature/index.html b/files/fr/web/api/featurepolicy/allowsfeature/index.html
new file mode 100644
index 0000000000..508e15dbb8
--- /dev/null
+++ b/files/fr/web/api/featurepolicy/allowsfeature/index.html
@@ -0,0 +1,76 @@
+---
+title: FeaturePolicy.allowsFeature()
+slug: Web/API/FeaturePolicy/allowsFeature
+tags:
+ - API
+ - Feature Policy
+ - Feature-Policy
+ - Reference
+translation_of: Web/API/FeaturePolicy/allowsFeature
+---
+<div>{{APIRef("Feature Policy API")}}{{SeeCompatTable}}</div>
+
+<p><span class="seoSummary">La méthode <strong><code>allowsFeature()</code></strong> de l'interface {{DOMxRef("FeaturePolicy")}} permet l'introspection de directives du Feature Policy sur lequel la méthode est appelée. Elle retourne un {{JSxRef("Boolean")}} valant <code>true</code> si et seulement si la fonctionnalité dont le nom de directive est fourni est permise dans le contexte spécifié (ou le contexte par défaut si aucun contexte n'est spécifié).</span></p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox notranslate">const listePermissions = <em>FeaturePolicy</em>.allowsFeature(&lt;nomDirective&gt;)
+</pre>
+
+<p>ou</p>
+
+<pre class="syntaxbox notranslate">const listePermissions = <em>FeaturePolicy</em>.allowsFeature(&lt;nomDirective&gt;, &lt;origine&gt;)</pre>
+
+<h3 id="Paramètres">Paramètres</h3>
+
+<h4 id="Nom_de_directive"><code>Nom de directive</code></h4>
+
+<p>Le nom de la directive associée à une fonctionnalité.</p>
+
+<h4 id="Origine_Optional_inline"><code>Origine</code> {{Optional_inline}}</h4>
+
+<p>Une URL d'origine sur lequel vérifier la disponibilité de la fonctionnalité. Si omise, sa valeur par défaut est utilisée.</p>
+
+<h3 id="Valeur_de_retour">Valeur de retour</h3>
+
+<p>Un {{JSxRef("Boolean")}} valant <code>true</code> si et seulement si la fonctionnalité est permise.</p>
+
+<h2 id="Exemple">Exemple</h2>
+
+<p>Cet exemple demande au document s'il lui est permis par Feature Policy d'utiliser l'API Camera (appareil photo). Notez que l'API Camera pourrait être restreinte par l'API Permissions si l'utilisateur n'a pas encore accordé la permission.</p>
+
+<pre class="brush: js notranslate">// D'abord, récupère le Feature Policy
+const featurePolicy = document.featurePolicy
+
+// Demande si la fonctionnalité est disponible
+const estPermise = featurePolicy.allowsFeature("camera")
+
+if (estPermise)
+  console.log("FP autorise l'appareil photo.")
+
+else
+  console.log("FP n'autorise pas l'appareil photo.")
+</pre>
+
+<h2 id="Spécifications">Spécifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Spécification</th>
+ <th scope="col">Statut</th>
+ <th scope="col">Commentaire</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("Feature Policy","","allowsFeature")}}</td>
+ <td>{{Spec2("Feature Policy")}}</td>
+ <td>Définition initiale.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+
+
+<p>{{Compat("api.FeaturePolicy.allowsFeature")}}</p>