--- title: FeaturePolicy.getAllowlistForFeature() slug: Web/API/FeaturePolicy/getAllowlistForFeature tags: - API - Feature Policy - Feature-Policy - Reference translation_of: Web/API/FeaturePolicy/getAllowlistForFeature --- <div>{{APIRef("Feature Policy API")}}{{SeeCompatTable}}</div> <p><span class="seoSummary">La méthode <strong><code>getAllowlistForFeature()</code></strong> de {{DOMxRef("FeaturePolicy")}} permet d'obtenir la liste des permissions associée à une fonctionnalité pour ce Feature Policy.</span></p> <h2 id="Syntaxe">Syntaxe</h2> <pre class="syntaxbox notranslate">const listePermissions = <em>FeaturePolicy</em>.getAllowlistForFeature(<fonctionnalité>) </pre> <h3 id="Parameter">Parameter</h3> <h4 id="Nom_de_fonctionnalité">Nom de fonctionnalité</h4> <p>Un nom de fonctionnalité doit être fourni.</p> <h3 id="Valeur_de_retour">Valeur de retour</h3> <p>Une <a href="fr/Web/HTTP/Feature_Policy/Using_Feature_Policy">liste de permissions</a> pour la fonctionnalité demandée est retournée.</p> <h2 id="Erreurs">Erreurs</h2> <p>La fonction jettera un avertissement si la directive de Feature Policy demandée est inconnue. Toutefois, elle retournera aussi un tableau vide, indiquant que l'utilisation de cette fonctionnalité n'est permise pour aucune origine.</p> <h2 id="Exemple">Exemple</h2> <p>Cet exemple affiche toutes les origines à qui la directive Feature Policy permet 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 l'objet Feature Policy const featurePolicy = document.featurePolicy // Puis demande la liste pour la fonctionnalité "camera" const listePermissions = featurePolicy.getAllowlistForFeature("camera") for (const origine of listePermissions) console.log(origine) </pre> <h2 id="Spécification">Spécification</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","","getAllowlistForFeature")}}</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.getAllowlistForFeature")}}</p>