这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
maxLayers
只读特性在
VRDisplayCapabilities
interface returns a number indicating the maximum number of
VRLayer
s that the VR display can present at once (e.g. the maximum length of the array that
Display.requestPresent()
can accept.)
var maximumLayers = vrDisplayCapabilitiesInstance.maxLayers;
A number, which must be 1 if
VRDisplayCapabilities.canPresent
is
true
, or 0 otherwise.
function reportDisplays() {
navigator.getVRDisplays().then(function(displays) {
for(var i = 0; i < displays.length; i++) {
var cap = displays[i].capabilities;
// cap is a VRDisplayCapabilities object
var listItem = document.createElement('li');
listItem.innerHTML = '<strong>Display ' + (i+1) + '</strong>'
+ '<br>VR Display ID: ' + displays[i].displayId
+ '<br>VR Display Name: ' + displays[i].displayName
+ '<br>Display can present content: ' + cap.canPresent
+ '<br>Display is separate from the computer\'s main display: ' + cap.hasExternalDisplay
+ '<br>Display can return position info: ' + cap.hasPosition
+ '<br>Display can return orientation info: ' + cap.hasOrientation
+ '<br>Display max layers: ' + cap.maxLayers;
list.appendChild(listItem);
}
});
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebVR 1.1
The definition of 'maxLayers' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
maxLayers
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。