FeaturePolicy: features() 方法
FeaturePolicy 接口的 features() 方法返回用户代理支持的所有功能的名称列表。名称出现在列表中的功能可能不被当前执行上下文的 Permissions Policy 允许,或者可能因为用户权限而无法访问。
语法
js
features()
参数
无。
返回值
一个字符串列表,表示用户代理支持的所有 Permissions Policy 指令的名称。
示例
以下示例将所有支持的指令记录到控制台。
js
// Get the FeaturePolicy object
const featurePolicy = document.featurePolicy;
// Retrieve the list of all supported Permissions Policy directives
const supportedDirectives = featurePolicy.features();
// Print out each directive into the console
for (const directive of supportedDirectives) {
console.log(directive);
}
规范
此特性似乎未在任何规范中定义。浏览器兼容性
加载中…