这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
features()
方法在
FeaturePolicy
interface returns a list of names of all features supported by the User Agent. Feature whose name appears on the list might not be allowed by the Feature Policy of the current execution context and/or might not be accessible because of user's permissions.
const supportedFeatures = FeaturePolicy.features()
None.
A list of strings that represent names of all Feature Policy directives supported by the User Agent.
The followin example logs all the supported directives in the console.
// Get the Feature Policy object
const featurePolicy = document.featurePolicy
// Retreive the list of all supported Feature Policy directives
const supportedDirectives = featurePolicy.features()
// Print out each directive into the console
for (const directive of supportedDirectives){
console.log(directive)
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Feature Policy
The definition of 'features' in that specification. |
编者草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
features
|
Chrome 74 | Edge 79 | Firefox 70 | IE No | Opera 62 | Safari No | WebView Android 74 | Chrome Android 74 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.0 |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。